class JLanguage extends JObject


Located at : UKNOWVA_ROOT/libraries/joomla/language/language.php

Languages/translation handler class

Methods

__construct(string $lang = null, boolean $debug = false)

Constructor activating the default information of the language.

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Get a metadata language property.

array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
static JLanguage
getInstance(string $lang, boolean $debug = false)

Returns a language object.

string
_($string, $jsSafe = false, $interpretBackSlashes = true)

Translate function, mimics the php gettext (alias _) function.

string
transliterate(string $string)

Transliterate function

string
getTransliterator()

Getter for transliteration function

mixed
setTransliterator(mixed $function)

Set the transliteration function.

array
getPluralSuffixes(integer $count)

Returns an array of suffixes for plural rules.

mixed
getPluralSufficesCallback() deprecated

Getter for pluralSuffixesCallback function.

mixed
getPluralSuffixesCallback()

Getter for pluralSuffixesCallback function.

mixed
setPluralSuffixesCallback(mixed $function)

Set the pluralSuffixes function.

array
getIgnoredSearchWords()

Returns an array of ignored search words

mixed
getIgnoredSearchWordsCallback()

Getter for ignoredSearchWordsCallback function.

mixed
setIgnoredSearchWordsCallback(mixed $function)

Setter for the ignoredSearchWordsCallback function

integer
getLowerLimitSearchWord()

Returns a lower limit integer for length of search words

mixed
getLowerLimitSearchWordCallback()

Getter for lowerLimitSearchWordCallback function

string|function
setLowerLimitSearchWordCallback(mixed $function)

Setter for the lowerLimitSearchWordCallback function.

integer
getUpperLimitSearchWord()

Returns an upper limit integer for length of search words

string|function
getUpperLimitSearchWordCallback()

Getter for upperLimitSearchWordCallback function

mixed
setUpperLimitSearchWordCallback($function)

Setter for the upperLimitSearchWordCallback function

integer
getSearchDisplayedCharactersNumber()

Returns the number of characters displayed in search results.

mixed
getSearchDisplayedCharactersNumberCallback()

Getter for searchDisplayedCharactersNumberCallback function

mixed
setSearchDisplayedCharactersNumberCallback($function)

Setter for the searchDisplayedCharactersNumberCallback function.

static boolean
exists(string $lang, string $basePath = JPATH_BASE)

Checks if a language exists.

boolean
load(string $extension = 'joomla', string $basePath = JPATH_BASE, string $lang = null, boolean $reload = false, boolean $default = true)

Loads a single language file and appends the results to the existing strings

string
getName()

Getter for Name.

array
getPaths(string $extension = null)

Get a list of language files that have been loaded.

array
getErrorFiles()

Get a list of language files that are in error state.

string
getTag()

Getter for the language tag (as defined in RFC 3066)

boolean
isRTL()

Get the RTL property.

bool
setDebug($debug)

Set the Debug property.

boolean
getDebug()

Get the Debug property.

string
getDefault()

Get the default language code.

string
setDefault($lang)

Set the default language code.

array
getOrphans()

Get the list of orphaned strings if being tracked.

array
getUsed()

Get the list of used strings.

bool
hasKey($string)

Determines is a key exists.

static mixed
getMetadata(string $lang)

Returns a associative array holding the metadata.

static array
getKnownLanguages(string $basePath = JPATH_BASE)

Returns a list of known languages for an area

static string
getLanguagePath(string $basePath = JPATH_BASE, string $language = null)

Get the path to a language

string
setLanguage(string $lang)

Set the language attributes to the given language.

array
getLocale()

Get the language locale based on current language.

integer
getFirstDay()

Get the first day of the week for this language.

static array
_parseLanguageFiles(string $dir = null) deprecated

Searches for language directories within a certain base dir.

static array
parseLanguageFiles(string $dir = null)

Searches for language directories within a certain base dir.

static array
_parseXMLLanguageFiles(string $dir = null) deprecated

Parses XML files for language information.

static array
parseXMLLanguageFiles(string $dir = null)

Parses XML files for language information

static array
_parseXMLLanguageFile(string $path) deprecated

Parse XML file for language information.

static array
parseXMLLanguageFile(string $path)

Parse XML file for language information.

Details

at line 167
JObject __construct(string $lang = null, boolean $debug = false)

Constructor activating the default information of the language.

Parameters

string $lang The language
boolean $debug Indicates if language debugging is enabled.

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

at line 859
mixed get(string $property, mixed $default = null)

Get a metadata language property.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

at line 254
static JLanguage getInstance(string $lang, boolean $debug = false)

Returns a language object.

Parameters

string $lang The language to use.
boolean $debug The debug mode.

Return Value

JLanguage The Language object.

at line 276
string _($string, $jsSafe = false, $interpretBackSlashes = true)

Translate function, mimics the php gettext (alias _) function.

The function checks if $jsSafe is true, then if $interpretBackslashes is true.

Parameters

$string
$jsSafe
$interpretBackSlashes

Return Value

string The translation of the string

at line 339
string transliterate(string $string)

Transliterate function

This method processes a string and replaces all accented UTF-8 characters by unaccented ASCII-7 "equivalents".

Parameters

string $string The string to transliterate.

Return Value

string The transliteration of the string.

at line 360
string getTransliterator()

Getter for transliteration function

Return Value

string Function name or the actual function for PHP 5.3.

at line 374
mixed setTransliterator(mixed $function)

Set the transliteration function.

Parameters

mixed $function Function name (string) or the actual function for PHP 5.3 (function).

Return Value

mixed

at line 391
array getPluralSuffixes(integer $count)

Returns an array of suffixes for plural rules.

Parameters

integer $count The count number the rule is for.

Return Value

array The array of suffixes.

at line 410
mixed getPluralSufficesCallback() deprecated

deprecated 12.1

Getter for pluralSuffixesCallback function.

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 422
mixed getPluralSuffixesCallback()

Getter for pluralSuffixesCallback function.

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 436
mixed setPluralSuffixesCallback(mixed $function)

Set the pluralSuffixes function.

Parameters

mixed $function Function name (string) or actual function for PHP 5.3 (function)

Return Value

mixed Function name or the actual function for PHP 5.3.

at line 451
array getIgnoredSearchWords()

Returns an array of ignored search words

Return Value

array The array of ignored search words.

at line 468
mixed getIgnoredSearchWordsCallback()

Getter for ignoredSearchWordsCallback function.

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 482
mixed setIgnoredSearchWordsCallback(mixed $function)

Setter for the ignoredSearchWordsCallback function

Parameters

mixed $function Function name (string) or actual function for PHP 5.3 (function)

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function)

at line 497
integer getLowerLimitSearchWord()

Returns a lower limit integer for length of search words

Return Value

integer The lower limit integer for length of search words (3 if no value was set for a specific language).

at line 514
mixed getLowerLimitSearchWordCallback()

Getter for lowerLimitSearchWordCallback function

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 528
string|function setLowerLimitSearchWordCallback(mixed $function)

Setter for the lowerLimitSearchWordCallback function.

Parameters

mixed $function Function name (string) or actual function for PHP 5.3 (function)

Return Value

string|function Function name or the actual function for PHP 5.3.

at line 543
integer getUpperLimitSearchWord()

Returns an upper limit integer for length of search words

Return Value

integer The upper limit integer for length of search words (20 if no value was set for a specific language).

at line 560
string|function getUpperLimitSearchWordCallback()

Getter for upperLimitSearchWordCallback function

Return Value

string|function Function name or the actual function for PHP 5.3.

at line 572
mixed setUpperLimitSearchWordCallback($function)

Setter for the upperLimitSearchWordCallback function

Parameters

$function

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 587
integer getSearchDisplayedCharactersNumber()

Returns the number of characters displayed in search results.

Return Value

integer The number of characters displayed (200 if no value was set for a specific language).

at line 604
mixed getSearchDisplayedCharactersNumberCallback()

Getter for searchDisplayedCharactersNumberCallback function

Return Value

mixed Function name or the actual function for PHP 5.3.

at line 616
mixed setSearchDisplayedCharactersNumberCallback($function)

Setter for the searchDisplayedCharactersNumberCallback function.

Parameters

$function

Return Value

mixed Function name (string) or the actual function for PHP 5.3 (function).

at line 636
static boolean exists(string $lang, string $basePath = JPATH_BASE)

Checks if a language exists.

This is a simple, quick check for the directory that should contain language files for the given user.

Parameters

string $lang Language to check.
string $basePath Optional path to check.

Return Value

boolean True if the language exists.

at line 673
boolean load(string $extension = 'joomla', string $basePath = JPATH_BASE, string $lang = null, boolean $reload = false, boolean $default = true)

Loads a single language file and appends the results to the existing strings

Parameters

string $extension The extension for which a language file should be loaded.
string $basePath The basepath to use.
string $lang The language to load, default null for the current language.
boolean $reload Flag that will force a language to be reloaded if set to true.
boolean $default Flag that force the default language to be loaded if the current does not exist.

Return Value

boolean True if the file has successfully loaded.

at line 916
string getName()

Getter for Name.

Return Value

string Official name element of the language.

at line 930
array getPaths(string $extension = null)

Get a list of language files that have been loaded.

Parameters

string $extension An optional extension name.

Return Value

array

at line 951
array getErrorFiles()

Get a list of language files that are in error state.

Return Value

array

at line 962
string getTag()

Getter for the language tag (as defined in RFC 3066)

Return Value

string The language tag.

at line 974
boolean isRTL()

Get the RTL property.

Return Value

boolean True is it an RTL language.

at line 986
bool setDebug($debug)

Set the Debug property.

Parameters

$debug

Return Value

bool Previous value.

at line 1000
boolean getDebug()

Get the Debug property.

Return Value

boolean True is in debug mode.

at line 1012
string getDefault()

Get the default language code.

Return Value

string Language code.

at line 1023
string setDefault($lang)

Set the default language code.

Parameters

$lang

Return Value

string Previous value.

at line 1037
array getOrphans()

Get the list of orphaned strings if being tracked.

Return Value

array Orphaned text.

at line 1051
array getUsed()

Get the list of used strings.

Used strings are those strings requested and found either as a string or a constant.

Return Value

array Used strings.

at line 1065
bool hasKey($string)

Determines is a key exists.

Parameters

$string

Return Value

bool True, if the key exists.

at line 1081
static mixed getMetadata(string $lang)

Returns a associative array holding the metadata.

Parameters

string $lang The name of the language.

Return Value

mixed If $lang exists return key/value pair with the language metadata, otherwise return NULL.

at line 1104
static array getKnownLanguages(string $basePath = JPATH_BASE)

Returns a list of known languages for an area

Parameters

string $basePath The basepath to use

Return Value

array key/value pair with the language file and real name.

at line 1122
static string getLanguagePath(string $basePath = JPATH_BASE, string $language = null)

Get the path to a language

Parameters

string $basePath The basepath to use.
string $language The language tag.

Return Value

string language related path or null.

at line 1144
string setLanguage(string $lang)

Set the language attributes to the given language.

Once called, the language still needs to be loaded using JLanguage::load().

Parameters

string $lang Language code.

Return Value

string Previous value.

at line 1160
array getLocale()

Get the language locale based on current language.

Return Value

array The locale according to the language.

at line 1183
integer getFirstDay()

Get the first day of the week for this language.

Return Value

integer The first day of the week according to the language

at line 1199
static array _parseLanguageFiles(string $dir = null) deprecated

deprecated 12.1

Searches for language directories within a certain base dir.

Parameters

string $dir Directory of files.

Return Value

array Array holding the found languages as filename => real name pairs.

at line 1213
static array parseLanguageFiles(string $dir = null)

Searches for language directories within a certain base dir.

Parameters

string $dir directory of files.

Return Value

array Array holding the found languages as filename => real name pairs.

at line 1242
static array _parseXMLLanguageFiles(string $dir = null) deprecated

deprecated 12.1

Parses XML files for language information.

Parameters

string $dir Directory of files.

Return Value

array Array holding the found languages as filename => metadata array.

at line 1256
static array parseXMLLanguageFiles(string $dir = null)

Parses XML files for language information

Parameters

string $dir Directory of files.

Return Value

array Array holding the found languages as filename => metadata array.

at line 1290
static array _parseXMLLanguageFile(string $path) deprecated

deprecated 12.1

Parse XML file for language information.

Parameters

string $path Path to the XML files.

Return Value

array Array holding the found metadata as a key => value pair.

at line 1304
static array parseXMLLanguageFile(string $path)

Parse XML file for language information.

Parameters

string $path Path to the XML files.

Return Value

array Array holding the found metadata as a key => value pair.