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