Language
Languages/translation handler class
| since |
1.7.0 |
|---|---|
| package |
Joomla CMS |
Methods
_
Translate function, mimics the php gettext (alias _) function.
_(string string, bool jsSafe = false, bool interpretBackSlashes = true) : string
The function checks if $jsSafe is true, then if $interpretBackslashes is true.
| since |
1.7.0 |
|---|
Arguments
- string
stringThe string to translate- jsSafe
boolMake the result javascript safe- interpretBackSlashes
boolInterpret \t and \n
Response
stringThe translation of the string
__construct
Constructor activating the default information of the language.
__construct(string lang = null, bool debug = false) : mixed
| since |
1.7.0 |
|---|
Arguments
- lang
stringThe language- debug
boolIndicates if language debugging is enabled.
Response
mixed
debugFile
Debugs a language file
debugFile(string filename) : int
| since |
3.6.3 |
|---|---|
| throws |
|
Arguments
- filename
stringAbsolute path to the file to debug
Response
intA count of the number of parsing errors
exists
Checks if a language exists.
exists(string lang, string basePath = JPATH_BASE) : bool
This is a simple, quick check for the directory that should contain language files for the given user.
| since |
1.7.0 |
|---|---|
| deprecated |
3.7.0, use LanguageHelper::exists() instead. |
Arguments
- lang
stringLanguage to check.- basePath
stringOptional path to check.
Response
boolTrue if the language exists.
get
Get a metadata language property.
get(string property, mixed default = null) : mixed
| since |
1.7.0 |
|---|
Arguments
- property
stringThe name of the property.- default
mixedThe default value.
Response
mixedThe value of the property.
getCalendar
Getter for the calendar type
getCalendar() : string
| since |
3.7.0 |
|---|
Response
stringThe calendar type.
getCallerInfo
Determine who called Language or JText.
getCallerInfo() : array
| since |
1.7.0 |
|---|
Response
arrayCaller information.
getDebug
Get the Debug property.
getDebug() : bool
| since |
1.7.0 |
|---|
Response
boolTrue is in debug mode.
getDefault
Get the default language code.
getDefault() : string
| since |
1.7.0 |
|---|
Response
stringLanguage code.
getErrorFiles
Get a list of language files that are in error state.
getErrorFiles() : array
| since |
1.7.0 |
|---|
Response
array
getFirstDay
Get the first day of the week for this language.
getFirstDay() : int
| since |
1.7.0 |
|---|
Response
intThe first day of the week according to the language
getIgnoredSearchWords
Returns an array of ignored search words
getIgnoredSearchWords() : array
| since |
1.7.0 |
|---|
Response
arrayThe array of ignored search words.
getIgnoredSearchWordsCallback
Getter for ignoredSearchWordsCallback function.
getIgnoredSearchWordsCallback() : callable
| since |
1.7.0 |
|---|
Response
callableFunction name or the actual function.
getInstance
Returns a language object.
getInstance(string lang, bool debug = false) : \Joomla\CMS\Language\Language
| since |
1.7.0 |
|---|
Arguments
- lang
stringThe language to use.- debug
boolThe debug mode.
Response
\Joomla\CMS\Language\LanguageThe Language object.
getKnownLanguages
Returns a list of known languages for an area
getKnownLanguages(string basePath = JPATH_BASE) : array
| since |
1.7.0 |
|---|---|
| deprecated |
3.7.0, use LanguageHelper::getKnownLanguages() instead. |
Arguments
- basePath
stringThe basepath to use
Response
arraykey/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 |
1.7.0 |
|---|---|
| deprecated |
3.7.0, use LanguageHelper::getLanguagePath() instead. |
Arguments
- basePath
stringThe basepath to use.- language
stringThe language tag.
Response
stringlanguage related path or null.
getLocale
Get the language locale based on current language.
getLocale() : array
| since |
1.7.0 |
|---|
Response
arrayThe locale according to the language.
getLowerLimitSearchWord
Returns a lower limit integer for length of search words
getLowerLimitSearchWord() : int
| since |
1.7.0 |
|---|
Response
intThe lower limit integer for length of search words (3 if no value was set for a specific language).
getLowerLimitSearchWordCallback
Getter for lowerLimitSearchWordCallback function
getLowerLimitSearchWordCallback() : callable
| since |
1.7.0 |
|---|
Response
callableFunction name or the actual function.
getMetadata
Returns an associative array holding the metadata.
getMetadata(string lang) : mixed
| since |
1.7.0 |
|---|---|
| deprecated |
3.7.0, use LanguageHelper::getMetadata() instead. |
Arguments
- lang
stringThe name of the language.
Response
mixedIf $lang exists return key/value pair with the language metadata, otherwise return NULL.
getName
Getter for Name.
getName() : string
| since |
1.7.0 |
|---|
Response
stringOfficial name element of the language.
getOrphans
Get the list of orphaned strings if being tracked.
getOrphans() : array
| since |
1.7.0 |
|---|
Response
arrayOrphaned text.
getPaths
Get a list of language files that have been loaded.
getPaths(string extension = null) : array
| since |
1.7.0 |
|---|
Arguments
- extension
stringAn optional extension name.
Response
array
getPluralSuffixes
Returns an array of suffixes for plural rules.
getPluralSuffixes(int count) : array
| since |
1.7.0 |
|---|
Arguments
- count
intThe count number the rule is for.
Response
arrayThe array of suffixes.
getPluralSuffixesCallback
Getter for pluralSuffixesCallback function.
getPluralSuffixesCallback() : callable
| since |
1.7.0 |
|---|
Response
callableFunction name or the actual function.
getSearchDisplayedCharactersNumber
Returns the number of characters displayed in search results.
getSearchDisplayedCharactersNumber() : int
| since |
1.7.0 |
|---|
Response
intThe number of characters displayed (200 if no value was set for a specific language).
getSearchDisplayedCharactersNumberCallback
Getter for searchDisplayedCharactersNumberCallback function
getSearchDisplayedCharactersNumberCallback() : callable
| since |
1.7.0 |
|---|
Response
callableFunction name or the actual function.
getTag
Getter for the language tag (as defined in RFC 3066)
getTag() : string
| since |
1.7.0 |
|---|
Response
stringThe language tag.
getTransliterator
Getter for transliteration function
getTransliterator() : callable
| since |
1.7.0 |
|---|
Response
callableThe transliterator function
getUpperLimitSearchWord
Returns an upper limit integer for length of search words
getUpperLimitSearchWord() : int
| since |
1.7.0 |
|---|
Response
intThe upper limit integer for length of search words (200 if no value was set or if default value is < 200).
getUpperLimitSearchWordCallback
Getter for upperLimitSearchWordCallback function
getUpperLimitSearchWordCallback() : callable
| since |
1.7.0 |
|---|
Response
callableFunction name or the actual function.
getUsed
Get the list of used strings.
getUsed() : array
Used strings are those strings requested and found either as a string or a constant.
| since |
1.7.0 |
|---|
Response
arrayUsed strings.
getWeekEnd
Get the weekends days for this language.
getWeekEnd() : string
| since |
3.2 |
|---|
Response
stringThe weekend days of the week separated by a comma according to the language
hasKey
Determines is a key exists.
hasKey(string string) : bool
| since |
1.7.0 |
|---|
Arguments
- string
stringThe key to check.
Response
boolTrue, if the key exists.
isRtl
Get the RTL property.
isRtl() : bool
| since |
1.7.0 |
|---|
Response
boolTrue is it an RTL language.
load
Loads a single language file and appends the results to the existing strings
load(string extension = 'joomla', string basePath = JPATH_BASE, string lang = null, bool reload = false, bool default = true) : bool
| since |
1.7.0 |
|---|
Arguments
- extension
stringThe extension for which a language file should be loaded.- basePath
stringThe basepath to use.- lang
stringThe language to load, default null for the current language.- reload
boolFlag that will force a language to be reloaded if set to true.- default
boolFlag that force the default language to be loaded if the current does not exist.
Response
boolTrue if the file has successfully loaded.
loadLanguage
Loads a language file.
loadLanguage(string fileName, string extension = 'unknown') : bool
This method will not note the successful loading of a file - use load() instead.
| see | Language::load() |
|---|---|
| since |
1.7.0 |
Arguments
- fileName
stringThe name of the file.- extension
stringThe name of the extension.
Response
boolTrue if new strings have been added to the language
parse
Parses a language file.
parse(string fileName) : array
| since |
1.7.0 |
|---|
Arguments
- fileName
stringThe name of the file.
Response
arrayThe array of parsed strings.
parseLanguageFiles
Searches for language directories within a certain base dir.
parseLanguageFiles(string dir = null) : array
| since |
1.7.0 |
|---|---|
| deprecated |
3.7.0, use LanguageHelper::parseLanguageFiles() instead. |
Arguments
- dir
stringdirectory of files.
Response
arrayArray holding the found languages as filename => real name pairs.
parseXMLLanguageFile
Parse XML file for language information.
parseXMLLanguageFile(string path) : array
| since |
1.7.0 |
|---|---|
| throws |
|
| deprecated |
3.7.0, use LanguageHelper::parseXMLLanguageFile() instead. |
Arguments
- path
stringPath to the XML files.
Response
arrayArray holding the found metadata as a key => value pair.
setDebug
Set the Debug property.
setDebug(bool debug) : bool
| since |
1.7.0 |
|---|
Arguments
- debug
boolThe debug setting.
Response
boolPrevious value.
setDefault
Set the default language code.
setDefault(string lang) : string
| since |
1.7.0 |
|---|
Arguments
- lang
stringThe language code.
Response
stringPrevious value.
setIgnoredSearchWordsCallback
Setter for the ignoredSearchWordsCallback function
setIgnoredSearchWordsCallback(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or actual function.
Response
callableThe previous function.
setLanguage
Set the language attributes to the given language.
setLanguage(string lang) : string
Once called, the language still needs to be loaded using Language::load().
| since |
1.7.0 |
|---|---|
| deprecated |
4.0 (CMS) - Instantiate a new Language object instead |
Arguments
- lang
stringLanguage code.
Response
stringPrevious value.
setLowerLimitSearchWordCallback
Setter for the lowerLimitSearchWordCallback function.
setLowerLimitSearchWordCallback(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or actual function.
Response
callableThe previous function.
setPluralSuffixesCallback
Set the pluralSuffixes function.
setPluralSuffixesCallback(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or actual function.
Response
callableThe previous function.
setSearchDisplayedCharactersNumberCallback
Setter for the searchDisplayedCharactersNumberCallback function.
setSearchDisplayedCharactersNumberCallback(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or the actual function.
Response
callableThe previous function.
setTransliterator
Set the transliteration function.
setTransliterator(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or the actual function.
Response
callableThe previous function.
setUpperLimitSearchWordCallback
Setter for the upperLimitSearchWordCallback function
setUpperLimitSearchWordCallback(callable function) : callable
| since |
1.7.0 |
|---|
Arguments
- function
callableFunction name or the actual function.
Response
callableThe previous function.
transliterate
Transliterate function
transliterate(string string) : string
This method processes a string and replaces all accented UTF-8 characters by unaccented ASCII-7 "equivalents".
| since |
1.7.0 |
|---|
Arguments
- string
stringThe string to transliterate.
Response
stringThe transliteration of the string.
Properties
languages
Array of Language objects
| since |
1.7.0 |
|---|
Type(s)
\Joomla\CMS\Language\Language[]
debug
Debug language, If true, highlights if string isn't found.
| since |
1.7.0 |
|---|
Type(s)
bool
default
The default language, used when a language file in the requested language does not exist.
| since |
1.7.0 |
|---|
Type(s)
string
orphans
An array of orphaned text.
| since |
1.7.0 |
|---|
Type(s)
array
metadata
Array holding the language metadata.
| since |
1.7.0 |
|---|
Type(s)
array
locale
Array holding the language locale or boolean null if none.
| since |
1.7.0 |
|---|
Type(s)
array|bool
lang
The language to load.
| since |
1.7.0 |
|---|
Type(s)
string
paths
A nested array of language files that have been loaded
| since |
1.7.0 |
|---|
Type(s)
array
errorfiles
List of language files that are in error state
| since |
1.7.0 |
|---|
Type(s)
array
strings
Translations
| since |
1.7.0 |
|---|
Type(s)
array
used
An array of used text, used during debugging.
| since |
1.7.0 |
|---|
Type(s)
array
counter
Counter for number of loads.
| since |
1.7.0 |
|---|
Type(s)
int
override
An array used to store overrides.
| since |
1.7.0 |
|---|
Type(s)
array
transliterator
Name of the transliterator function for this language.
| since |
1.7.0 |
|---|
Type(s)
string
pluralSuffixesCallback
Name of the pluralSuffixesCallback function for this language.
| since |
1.7.0 |
|---|
Type(s)
callable
ignoredSearchWordsCallback
Name of the ignoredSearchWordsCallback function for this language.
| since |
1.7.0 |
|---|
Type(s)
callable
lowerLimitSearchWordCallback
Name of the lowerLimitSearchWordCallback function for this language.
| since |
1.7.0 |
|---|
Type(s)
callable
upperLimitSearchWordCallback
Name of the upperLimitSearchWordCallback function for this language.
| since |
1.7.0 |
|---|
Type(s)
callable
searchDisplayedCharactersNumberCallback
Name of the searchDisplayedCharactersNumberCallback function for this language.
| since |
1.7.0 |
|---|
Type(s)
callable