LanguageHelper
Language helper class
since |
1.5 |
---|
Methods
createLanguageList
Builds a list of the system languages which can be used in a select option
createLanguageList(string $actualLanguage, string $basePath = JPATH_BASE, boolean $caching = false, boolean $installed = false) : array
since |
1.5 |
---|
Arguments
- $actualLanguage
string
Client key for the area- $basePath
string
Base path to use- $caching
boolean
True if caching is used- $installed
boolean
Get only installed languages
Response
array
List of system languages
detectLanguage
Tries to detect the language.
detectLanguage() : string
since |
1.5 |
---|
Response
string
locale or null if not found
exists
Checks if a language exists.
exists(string $lang, string $basePath = JPATH_BASE) : boolean
This is a simple, quick check for the directory that should contain language files for the given user.
since |
3.7.0 |
---|
Arguments
- $lang
string
Language to check.- $basePath
string
Optional path to check.
Response
boolean
True if the language exists.
getContentLanguages
Get a list of content languages.
getContentLanguages(array $publishedStates = array(1), boolean $checkInstalled = true, string $pivot = 'lang_code', string $orderField = null, string $orderDirection = null) : array
since |
3.7.0 |
---|
Arguments
- $publishedStates
array
Array with the content language published states. Empty array for all.- $checkInstalled
boolean
Check if the content language is installed.- $pivot
string
The pivot of the returning array.- $orderField
string
Field to order the results.- $orderDirection
string
Direction to order the results.
Response
array
Array of the content languages.
getInstalledLanguages
Get a list of installed languages.
getInstalledLanguages(integer $clientId = null, boolean $processMetaData = false, boolean $processManifest = false, string $pivot = 'element', string $orderField = null, string $orderDirection = null) : array
since |
3.7.0 |
---|
Arguments
- $clientId
integer
The client app id.- $processMetaData
boolean
Fetch Language metadata.- $processManifest
boolean
Fetch Language manifest.- $pivot
string
The pivot of the returning array.- $orderField
string
Field to order the results.- $orderDirection
string
Direction to order the results.
Response
array
Array with the installed languages.
getKnownLanguages
Returns a list of known languages for an area
getKnownLanguages(string $basePath = JPATH_BASE) : array
since |
3.7.0 |
---|
Arguments
- $basePath
string
The basepath to use
Response
array
key/value pair with the language file and real name.
getLanguagePath
Get the path to a language
getLanguagePath(string $basePath = JPATH_BASE, string $language = null) : string
since |
3.7.0 |
---|
Arguments
- $basePath
string
The basepath to use.- $language
string
The language tag.
Response
string
language related path or null.
getLanguages
Get available languages
getLanguages(string $key = 'default') : array
since |
1.6 |
---|
Arguments
- $key
string
Array key
Response
array
An array of published languages
getMetadata
Returns an associative array holding the metadata.
getMetadata(string $lang) : mixed
since |
3.7.0 |
---|
Arguments
- $lang
string
The name of the language.
Response
mixed
If $lang exists return key/value pair with the language metadata, otherwise return NULL.
parseIniFile
Parse strings from a language file.
parseIniFile(string $fileName, boolean $debug = false) : array
since |
3.9.0 |
---|
Arguments
- $fileName
string
The language ini file path.- $debug
boolean
If set to true debug language ini file.
Response
array
parseLanguageFiles
Searches for language directories within a certain base dir.
parseLanguageFiles(string $dir = null) : array
since |
3.7.0 |
---|
Arguments
- $dir
string
directory of files.
Response
array
Array holding the found languages as filename => real name pairs.
parseXMLLanguageFile
Parse XML file for language information.
parseXMLLanguageFile(string $path) : array
since |
3.7.0 |
---|---|
throws |
|
Arguments
- $path
string
Path to the XML files.
Response
array
Array holding the found metadata as a key => value pair.
saveToIniFile
Save strings to a language file.
saveToIniFile(string $fileName, array $strings) : boolean
since |
3.7.0 |
---|
Arguments
- $fileName
string
The language ini file path.- $strings
array
The array of strings.
Response
boolean
True if saved, false otherwise.