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
string
The string to translate- jsSafe
bool
Parameter to add slashes to the string that will be rendered as JavaScript. However, set as "false" if the string is going to be encoded by json_encode().- interpretBackSlashes
bool
Interpret \t and \n
Response
string
The 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
string
The language- debug
bool
Indicates if language debugging is enabled.
Response
mixed
debugFile
Debugs a language file
debugFile(string filename) : int
since |
3.6.3 |
---|---|
throws |
|
Arguments
- filename
string
Absolute path to the file to debug
Response
int
A count of the number of parsing errors
get
Get a metadata language property.
get(string property, mixed default = null) : mixed
since |
1.7.0 |
---|
Arguments
- property
string
The name of the property.- default
mixed
The default value.
Response
mixed
The value of the property.
getCalendar
Getter for the calendar type
getCalendar() : string
since |
3.7.0 |
---|
Response
string
The calendar type.
getCallerInfo
Determine who called Language or Text.
getCallerInfo() : array
since |
1.7.0 |
---|
Response
array
Caller information.
getDebug
Get the Debug property.
getDebug() : bool
since |
1.7.0 |
---|
Response
bool
True is in debug mode.
getDefault
Get the default language code.
getDefault() : string
since |
1.7.0 |
---|
Response
string
Language 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
int
The first day of the week according to the language
getIgnoredSearchWords
Returns an array of ignored search words
getIgnoredSearchWords() : array
since |
1.7.0 |
---|
Response
array
The array of ignored search words.
getIgnoredSearchWordsCallback
Getter for ignoredSearchWordsCallback function.
getIgnoredSearchWordsCallback() : callable
since |
1.7.0 |
---|
Response
callable
Function name or the actual function.
getInstance
Returns a language object.
getInstance(string lang, bool debug = false) : \Joomla\CMS\Language\Language
since |
1.7.0 |
---|---|
deprecated |
5.0 Use the language factory instead |
Arguments
- lang
string
The language to use.- debug
bool
The debug mode.
Response
\Joomla\CMS\Language\Language
The Language object.
getLocale
Get the language locale based on current language.
getLocale() : array
since |
1.7.0 |
---|
Response
array
The locale according to the language.
getLowerLimitSearchWord
Returns a lower limit integer for length of search words
getLowerLimitSearchWord() : int
since |
1.7.0 |
---|
Response
int
The 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
callable
Function name or the actual function.
getName
Getter for Name.
getName() : string
since |
1.7.0 |
---|
Response
string
Official name element of the language.
getOrphans
Get the list of orphaned strings if being tracked.
getOrphans() : array
since |
1.7.0 |
---|
Response
array
Orphaned text.
getPaths
Get a list of language files that have been loaded.
getPaths(string extension = null) : array
since |
1.7.0 |
---|
Arguments
- extension
string
An optional extension name.
Response
array
getPluralSuffixes
Returns an array of suffixes for plural rules.
getPluralSuffixes(int count) : array
since |
1.7.0 |
---|
Arguments
- count
int
The count number the rule is for.
Response
array
The array of suffixes.
getPluralSuffixesCallback
Getter for pluralSuffixesCallback function.
getPluralSuffixesCallback() : callable
since |
1.7.0 |
---|
Response
callable
Function name or the actual function.
getSearchDisplayedCharactersNumber
Returns the number of characters displayed in search results.
getSearchDisplayedCharactersNumber() : int
since |
1.7.0 |
---|
Response
int
The 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
callable
Function name or the actual function.
getTag
Getter for the language tag (as defined in RFC 3066)
getTag() : string
since |
1.7.0 |
---|
Response
string
The language tag.
getTrace
Get a back trace.
getTrace() : array
since |
4.0.0 |
---|
Response
array
getTransliterator
Getter for transliteration function
getTransliterator() : callable
since |
1.7.0 |
---|
Response
callable
The transliterator function
getUpperLimitSearchWord
Returns an upper limit integer for length of search words
getUpperLimitSearchWord() : int
since |
1.7.0 |
---|
Response
int
The 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
callable
Function 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
array
Used strings.
getWeekEnd
Get the weekends days for this language.
getWeekEnd() : string
since |
3.2 |
---|
Response
string
The 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
string
The key to check.
Response
bool
True, if the key exists.
isRtl
Get the RTL property.
isRtl() : bool
since |
1.7.0 |
---|
Response
bool
True 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
string
The extension for which a language file should be loaded.- basePath
string
The basepath to use.- lang
string
The language to load, default null for the current language.- reload
bool
Flag that will force a language to be reloaded if set to true.- default
bool
Flag that force the default language to be loaded if the current does not exist.
Response
bool
True 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
string
The name of the file.- extension
string
The name of the extension.
Response
bool
True if new strings have been added to the language
parse
Parses a language file.
parse(string fileName) : array
since |
1.7.0 |
---|
Arguments
- fileName
string
The name of the file.
Response
array
The array of parsed strings.
setDebug
Set the Debug property.
setDebug(bool debug) : bool
since |
1.7.0 |
---|
Arguments
- debug
bool
The debug setting.
Response
bool
Previous value.
setDefault
Set the default language code.
setDefault(string lang) : string
since |
1.7.0 |
---|
Arguments
- lang
string
The language code.
Response
string
Previous value.
setIgnoredSearchWordsCallback
Setter for the ignoredSearchWordsCallback function
setIgnoredSearchWordsCallback(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or actual function.
Response
callable
The previous function.
setLowerLimitSearchWordCallback
Setter for the lowerLimitSearchWordCallback function.
setLowerLimitSearchWordCallback(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or actual function.
Response
callable
The previous function.
setPluralSuffixesCallback
Set the pluralSuffixes function.
setPluralSuffixesCallback(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or actual function.
Response
callable
The previous function.
setSearchDisplayedCharactersNumberCallback
Setter for the searchDisplayedCharactersNumberCallback function.
setSearchDisplayedCharactersNumberCallback(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or the actual function.
Response
callable
The previous function.
setTransliterator
Set the transliteration function.
setTransliterator(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or the actual function.
Response
callable
The previous function.
setUpperLimitSearchWordCallback
Setter for the upperLimitSearchWordCallback function
setUpperLimitSearchWordCallback(callable function) : callable
since |
1.7.0 |
---|
Arguments
- function
callable
Function name or the actual function.
Response
callable
The 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
string
The string to transliterate.
Response
string
The transliteration of the string.
Properties
default
The default language, used when a language file in the requested language does not exist.
pluralSuffixesCallback
Name of the pluralSuffixesCallback function for this language.
ignoredSearchWordsCallback
Name of the ignoredSearchWordsCallback function for this language.
lowerLimitSearchWordCallback
Name of the lowerLimitSearchWordCallback function for this language.
upperLimitSearchWordCallback
Name of the upperLimitSearchWordCallback function for this language.
searchDisplayedCharactersNumberCallback
Name of the searchDisplayedCharactersNumberCallback function for this language.