Class JLanguage

Description

Languages/translation handler class

  • since: 11.1

Located in /libraries/joomla/language/language.php (line 24)


	
			
Variable Summary
Method Summary
 static boolean exists (string $lang, [string $basePath = JPATH_BASE])
 static JLanguage getInstance (string $lang, [boolean $debug = false])
 static array getKnownLanguages ([string $basePath = JPATH_BASE])
 static string getLanguagePath ([string $basePath = JPATH_BASE], [string $language = null])
 static mixed getMetadata (string $lang)
 static array parseLanguageFiles ([string $dir = null])
 static array parseXMLLanguageFile (string $path)
 JLanguage __construct ([string $lang = null], [boolean $debug = false])
 mixed get (string $property, [mixed $default = null])
 array getCallerInfo ()
 boolean getDebug ()
 string getDefault ()
 array getErrorFiles ()
 integer getFirstDay ()
 array getLocale ()
 string getName ()
 array getOrphans ()
 array getPaths ([string $extension = null])
 array getPluralSuffixes (integer $count)
 string getTag ()
 callable getTransliterator ()
 array getUsed ()
 string getWeekEnd ()
 boolean hasKey (string $string)
 boolean isRTL ()
 boolean load ([string $extension = 'joomla'], [string $basePath = JPATH_BASE], [string $lang = null], [boolean $reload = false], [boolean $default = true])
 boolean loadLanguage (string $filename, [string $extension = 'unknown'])
 array parse (string $filename)
 boolean setDebug (boolean $debug)
 string setDefault (string $lang)
 callable setIgnoredSearchWordsCallback (callable $function)
 string setLanguage (string $lang)
 callable setLowerLimitSearchWordCallback (callable $function)
 callable setPluralSuffixesCallback (callable $function)
 callable setSearchDisplayedCharactersNumberCallback (callable $function)
 callable setTransliterator (callable $function)
 callable setUpperLimitSearchWordCallback (callable $function)
 string transliterate (string $string)
 string _ (string $string, [boolean $jsSafe = false], [boolean $interpretBackSlashes = true])
Variables
static array $languages = array() (line 32)

Array of JLanguage objects

  • since: 11.1
  • access: protected
integer $counter = 0 (line 120)

Counter for number of loads.

  • since: 11.1
  • access: protected
boolean $debug = false (line 40)

Debug language, If true, highlights if string isn't found.

  • since: 11.1
  • access: protected
string $default = 'en-GB' (line 48)

The default language, used when a language file in the requested language does not exist.

  • since: 11.1
  • access: protected
array $errorfiles = array() (line 96)

List of language files that are in error state

  • since: 11.1
  • access: protected
callable $ignoredSearchWordsCallback = null (line 152)

Name of the ignoredSearchWordsCallback function for this language.

  • since: 11.1
  • access: protected
string $lang = null (line 80)

The language to load.

  • since: 11.1
  • access: protected
array|boolean $locale = null (line 72)

Array holding the language locale or boolean null if none.

  • since: 11.1
  • access: protected
callable $lowerLimitSearchWordCallback = null (line 160)

Name of the lowerLimitSearchWordCallback function for this language.

  • since: 11.1
  • access: protected
array $metadata = null (line 64)

Array holding the language metadata.

  • since: 11.1
  • access: protected
array $orphans = array() (line 56)

An array of orphaned text.

  • since: 11.1
  • access: protected
array $override = array() (line 128)

An array used to store overrides.

  • since: 11.1
  • access: protected
array $paths = array() (line 88)

A nested array of language files that have been loaded

  • since: 11.1
  • access: protected
callable $pluralSuffixesCallback = null (line 144)

Name of the pluralSuffixesCallback function for this language.

  • since: 11.1
  • access: protected
callable $searchDisplayedCharactersNumberCallback = null (line 176)

Name of the searchDisplayedCharactersNumberCallback function for this language.

  • since: 11.1
  • access: protected
array $strings = array() (line 104)

Translations

  • since: 11.1
  • access: protected
string $transliterator = null (line 136)

Name of the transliterator function for this language.

  • since: 11.1
  • access: protected
callable $upperLimitSearchWordCallback = null (line 168)

Name of the uppperLimitSearchWordCallback function for this language.

  • since: 11.1
  • access: protected
array $used = array() (line 112)

An array of used text, used during debugging.

  • since: 11.1
  • access: protected
Methods
static exists (line 687)

Checks if a language exists.

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

  • return: True if the language exists.
  • since: 11.1
  • access: public
static boolean exists (string $lang, [string $basePath = JPATH_BASE])
  • string $lang: Language to check.
  • string $basePath: Optional path to check.
static getInstance (line 297)

Returns a language object.

  • return: The Language object.
  • since: 11.1
  • access: public
static JLanguage getInstance (string $lang, [boolean $debug = false])
  • string $lang: The language to use.
  • boolean $debug: The debug mode.
static getKnownLanguages (line 1191)

Returns a list of known languages for an area

  • return: key/value pair with the language file and real name.
  • since: 11.1
  • access: public
static array getKnownLanguages ([string $basePath = JPATH_BASE])
  • string $basePath: The basepath to use
static getLanguagePath (line 1209)

Get the path to a language

  • return: language related path or null.
  • since: 11.1
  • access: public
static string getLanguagePath ([string $basePath = JPATH_BASE], [string $language = null])
  • string $basePath: The basepath to use.
  • string $language: The language tag.
static getMetadata (line 1162)

Returns a associative array holding the metadata.

  • return: If $lang exists return key/value pair with the language metadata, otherwise return NULL.
  • since: 11.1
  • access: public
static mixed getMetadata (string $lang)
  • string $lang: The name of the language.
static parseLanguageFiles (line 1300)

Searches for language directories within a certain base dir.

  • return: Array holding the found languages as filename => real name pairs.
  • since: 11.1
  • access: public
static array parseLanguageFiles ([string $dir = null])
  • string $dir: directory of files.
static parseXMLLanguageFile (line 1346)

Parse XML file for language information.

  • return: Array holding the found metadata as a key => value pair.
  • throws: RuntimeException
  • since: 11.1
  • access: public
static array parseXMLLanguageFile (string $path)
  • string $path: Path to the XML files.
Constructor __construct (line 186)

Constructor activating the default information of the language.

  • since: 11.1
  • access: public
JLanguage __construct ([string $lang = null], [boolean $debug = false])
  • string $lang: The language
  • boolean $debug: Indicates if language debugging is enabled.
get (line 925)

Get a metadata language property.

  • return: The value of the property.
  • since: 11.1
  • access: public
mixed get (string $property, [mixed $default = null])
  • string $property: The name of the property.
  • mixed $default: The default value.
getCallerInfo (line 942)

Determine who called JLanguage or JText.

  • return: Caller information.
  • since: 11.1
  • access: protected
array getCallerInfo ()
getDebug (line 1077)

Get the Debug property.

  • return: True is in debug mode.
  • since: 11.1
  • access: public
boolean getDebug ()
getDefault (line 1089)

Get the default language code.

  • return: Language code.
  • since: 11.1
  • access: public
string getDefault ()
getErrorFiles (line 1024)

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

  • since: 11.1
  • access: public
array getErrorFiles ()
getFirstDay (line 1274)

Get the first day of the week for this language.

  • return: The first day of the week according to the language
  • since: 11.1
  • access: public
integer getFirstDay ()
getIgnoredSearchWords (line 490)

Returns an array of ignored search words

  • return: The array of ignored search words.
  • since: 11.1
  • access: public
array getIgnoredSearchWords ()
getIgnoredSearchWordsCallback (line 509)

Getter for ignoredSearchWordsCallback function.

  • return: Function name or the actual function.
  • since: 11.1
  • access: public
callable getIgnoredSearchWordsCallback ()
getLocale (line 1248)

Get the language locale based on current language.

  • return: The locale according to the language.
  • since: 11.1
  • access: public
array getLocale ()
getLowerLimitSearchWord (line 538)

Returns a lower limit integer for length of search words

  • return: The lower limit integer for length of search words (3 if no value was set for a specific language).
  • since: 11.1
  • access: public
integer getLowerLimitSearchWord ()
getLowerLimitSearchWordCallback (line 557)

Getter for lowerLimitSearchWordCallback function

  • return: Function name or the actual function.
  • since: 11.1
  • access: public
callable getLowerLimitSearchWordCallback ()
getName (line 986)

Getter for Name.

  • return: Official name element of the language.
  • since: 11.1
  • access: public
string getName ()
getOrphans (line 1118)

Get the list of orphaned strings if being tracked.

  • return: Orphaned text.
  • since: 11.1
  • access: public
array getOrphans ()
getPaths (line 1000)

Get a list of language files that have been loaded.

  • since: 11.1
  • access: public
array getPaths ([string $extension = null])
  • string $extension: An optional extension name.
getPluralSuffixes (line 442)

Returns an array of suffixes for plural rules.

  • return: The array of suffixes.
  • since: 11.1
  • access: public
array getPluralSuffixes (integer $count)
  • integer $count: The count number the rule is for.
getPluralSuffixesCallback (line 461)

Getter for pluralSuffixesCallback function.

  • return: Function name or the actual function.
  • since: 11.1
  • access: public
callable getPluralSuffixesCallback ()
getSearchDisplayedCharactersNumber (line 634)

Returns the number of characters displayed in search results.

  • return: The number of characters displayed (200 if no value was set for a specific language).
  • since: 11.1
  • access: public
integer getSearchDisplayedCharactersNumber ()
getSearchDisplayedCharactersNumberCallback (line 653)

Getter for searchDisplayedCharactersNumberCallback function

  • return: Function name or the actual function.
  • since: 11.1
  • access: public
callable getSearchDisplayedCharactersNumberCallback ()
getTag (line 1036)

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

  • return: The language tag.
  • since: 11.1
  • access: public
string getTag ()
getTransliterator (line 411)

Getter for transliteration function

  • return: The transliterator function
  • since: 11.1
  • access: public
callable getTransliterator ()
getUpperLimitSearchWord (line 586)

Returns an upper limit integer for length of search words

  • return: The upper limit integer for length of search words (20 if no value was set for a specific language).
  • since: 11.1
  • access: public
integer getUpperLimitSearchWord ()
getUpperLimitSearchWordCallback (line 605)

Getter for upperLimitSearchWordCallback function

  • return: Function name or the actual function.
  • since: 11.1
  • access: public
callable getUpperLimitSearchWordCallback ()
getUsed (line 1132)

Get the list of used strings.

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

  • return: Used strings.
  • since: 11.1
  • access: public
array getUsed ()
getWeekEnd (line 1286)

Get the weekends days for this language.

  • return: The weekend days of the week separated by a comma according to the language
  • since: 3.2
  • access: public
string getWeekEnd ()
hasKey (line 1146)

Determines is a key exists.

  • return: True, if the key exists.
  • since: 11.1
  • access: public
boolean hasKey (string $string)
  • string $string: The key to check.
isRTL (line 1048)

Get the RTL property.

  • return: True is it an RTL language.
  • since: 11.1
  • access: public
boolean isRTL ()
load (line 724)

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

  • return: True if the file has successfully loaded.
  • since: 11.1
  • access: public
boolean load ([string $extension = 'joomla'], [string $basePath = JPATH_BASE], [string $lang = null], [boolean $reload = false], [boolean $default = true])
  • 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.
loadLanguage (line 789)

Loads a language file.

This method will not note the successful loading of a file - use load() instead.

  • return: True if new strings have been added to the language
  • see: JLanguage::load()
  • since: 11.1
  • access: protected
boolean loadLanguage (string $filename, [string $extension = 'unknown'])
  • string $filename: The name of the file.
  • string $extension: The name of the extension.
parse (line 838)

Parses a language file.

  • return: The array of parsed strings.
  • since: 11.1
  • access: protected
array parse (string $filename)
  • string $filename: The name of the file.
setDebug (line 1062)

Set the Debug property.

  • return: Previous value.
  • since: 11.1
  • access: public
boolean setDebug (boolean $debug)
  • boolean $debug: The debug setting.
setDefault (line 1103)

Set the default language code.

  • return: Previous value.
  • since: 11.1
  • access: public
string setDefault (string $lang)
  • string $lang: The language code.
setIgnoredSearchWordsCallback (line 523)

Setter for the ignoredSearchWordsCallback function

  • return: The previous function.
  • since: 11.1
  • access: public
callable setIgnoredSearchWordsCallback (callable $function)
  • callable $function: Function name or actual function.
setLanguage (line 1232)

Set the language attributes to the given language.

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

  • return: Previous value.
  • since: 11.1
  • access: public
string setLanguage (string $lang)
  • string $lang: Language code.
setLowerLimitSearchWordCallback (line 571)

Setter for the lowerLimitSearchWordCallback function.

  • return: The previous function.
  • since: 11.1
  • access: public
callable setLowerLimitSearchWordCallback (callable $function)
  • callable $function: Function name or actual function.
setPluralSuffixesCallback (line 475)

Set the pluralSuffixes function.

  • return: The previous function.
  • since: 11.1
  • access: public
callable setPluralSuffixesCallback (callable $function)
  • callable $function: Function name or actual function.
setSearchDisplayedCharactersNumberCallback (line 667)

Setter for the searchDisplayedCharactersNumberCallback function.

  • return: The previous function.
  • since: 11.1
  • access: public
callable setSearchDisplayedCharactersNumberCallback (callable $function)
  • callable $function: Function name or the actual function.
setTransliterator (line 425)

Set the transliteration function.

  • return: The previous function.
  • since: 11.1
  • access: public
callable setTransliterator (callable $function)
  • callable $function: Function name or the actual function.
setUpperLimitSearchWordCallback (line 619)

Setter for the upperLimitSearchWordCallback function

  • return: The previous function.
  • since: 11.1
  • access: public
callable setUpperLimitSearchWordCallback (callable $function)
  • callable $function: Function name or the actual function.
transliterate (line 391)

Transliterate function

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

  • return: The transliteration of the string.
  • since: 11.1
  • access: public
string transliterate (string $string)
  • string $string: The string to transliterate.
_ (line 320)

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

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

  • return: The translation of the string
  • since: 11.1
  • access: public
string _ (string $string, [boolean $jsSafe = false], [boolean $interpretBackSlashes = true])
  • string $string: The string to translate
  • boolean $jsSafe: Make the result javascript safe
  • boolean $interpretBackSlashes: Interpret \t and \n

Documentation generated on Tue, 19 Nov 2013 15:06:25 +0100 by phpDocumentor 1.4.3