Class JLanguage

Description

Languages/translation handler class

  • since: 11.1

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

JObject
   |
   --JLanguage
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)
static array parseXMLLanguageFiles ([string $dir = null])
static array _parseLanguageFiles ([string $dir = null])
static array _parseXMLLanguageFile (string $path)
static array _parseXMLLanguageFiles ([string $dir = null])
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 ()
string getTransliterator ()
string|function getUpperLimitSearchWordCallback ()
array getUsed ()
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'], [boolean $overwrite = true])
array parse (string $filename)
boolean setDebug (boolean $debug)
string setDefault (string $lang)
mixed setIgnoredSearchWordsCallback (mixed $function)
string setLanguage (string $lang)
string|function setLowerLimitSearchWordCallback (mixed $function)
mixed setPluralSuffixesCallback (mixed $function)
mixed setSearchDisplayedCharactersNumberCallback (string $function)
mixed setTransliterator (mixed $function)
mixed setUpperLimitSearchWordCallback (string $function)
string transliterate (string $string)
string _ (string $string, [boolean $jsSafe = false], [boolean $interpretBackSlashes = true])
Variables
static mixed $languages = array() (line 29)
  • access: protected
integer $counter = 0 (line 106)

Counter for number of loads.

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

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

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

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

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

List of language files that are in error state

  • since: 11.1
  • access: protected
string $ignoredSearchWordsCallback = null (line 134)

Name of the ignoredSearchWordsCallback function for this language.

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

The language to load.

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

Array holding the language locale or boolean null if none.

  • since: 11.1
  • access: protected
string $lowerLimitSearchWordCallback = null (line 141)

Name of the lowerLimitSearchWordCallback function for this language.

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

Array holding the language metadata.

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

An array of orphaned text.

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

An array used to store overrides.

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

A nested array of language files that have been loaded

  • since: 11.1
  • access: protected
string $pluralSuffixesCallback = null (line 127)

Name of the pluralSuffixesCallback function for this language.

  • since: 11.1
  • access: protected
string $searchDisplayedCharactersNumberCallback = null (line 155)

Name of the searchDisplayedCharactersNumberCallback function for this language.

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

Translations

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

Name of the transliterator function for this language.

  • since: 11.1
  • access: protected
string $upperLimitSearchWordCallback = null (line 148)

Name of the uppperLimitSearchWordCallback function for this language

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

An array of used text, used during debugging.

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static method exists (line 676)

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 method getInstance (line 266)

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 method getKnownLanguages (line 1186)

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 method getLanguagePath (line 1204)

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 method 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 method parseLanguageFiles (line 1302)

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 method parseXMLLanguageFile (line 1399)

Parse XML file for language information.

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

Parses XML files for language information

  • return: Array holding the found languages as filename => metadata array.
  • since: 11.1
  • access: public
static array parseXMLLanguageFiles ([string $dir = null])
  • string $dir: Directory of files.
static method _parseLanguageFiles (line 1285)

Searches for language directories within a certain base dir.

  • return: Array holding the found languages as filename => real name pairs.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static array _parseLanguageFiles ([string $dir = null])
  • string $dir: Directory of files.
static method _parseXMLLanguageFile (line 1385)

Parse XML file for language information.

  • return: Array holding the found metadata as a key => value pair.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static array _parseXMLLanguageFile (string $path)
  • string $path: Path to the XML files.
static method _parseXMLLanguageFiles (line 1331)

Parses XML files for language information.

  • return: Array holding the found languages as filename => metadata array.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static array _parseXMLLanguageFiles ([string $dir = null])
  • string $dir: Directory of files.
Constructor __construct (line 165)

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.

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
get (line 926)

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.

Redefinition of:
JObject::get()
Returns a property of the object or the default value if the property is not set.
getCallerInfo (line 943)

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 1269)

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 479)

Returns an array of ignored search words

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

Getter for ignoredSearchWordsCallback function.

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • since: 11.1
  • access: public
mixed getIgnoredSearchWordsCallback ()
getLocale (line 1243)

Get the language locale based on current language.

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

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 546)

Getter for lowerLimitSearchWordCallback function

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • since: 11.1
  • access: public
mixed 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.
getPluralSufficesCallback (line 435)

Getter for pluralSuffixesCallback function.

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • deprecated: 12.1
  • since: 11.1
  • access: public
mixed getPluralSufficesCallback ()
getPluralSuffixes (line 413)

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 450)

Getter for pluralSuffixesCallback function.

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • since: 11.1
  • access: public
mixed getPluralSuffixesCallback ()
getSearchDisplayedCharactersNumber (line 623)

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 642)

Getter for searchDisplayedCharactersNumberCallback function

  • return: Function name or the actual function for PHP 5.3.
  • since: 11.1
  • access: public
mixed 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 382)

Getter for transliteration function

  • return: Function name or the actual function for PHP 5.3.
  • since: 11.1
  • access: public
string getTransliterator ()
getUpperLimitSearchWord (line 575)

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 594)

Getter for upperLimitSearchWordCallback function

  • return: Function name or the actual function for PHP 5.3.
  • since: 11.1
  • access: public
string|function 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 ()
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 715)

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 776)

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'], [boolean $overwrite = true])
  • string $filename: The name of the file.
  • string $extension: The name of the extension.
  • boolean $overwrite: Not used??
parse (line 822)

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 512)

Setter for the ignoredSearchWordsCallback function

  • return: Function name (string) or the actual function for PHP 5.3 (function)
  • since: 11.1
  • access: public
mixed setIgnoredSearchWordsCallback (mixed $function)
  • mixed $function: Function name (string) or actual function for PHP 5.3 (function)
setLanguage (line 1227)

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 560)

Setter for the lowerLimitSearchWordCallback function.

  • return: Function name or the actual function for PHP 5.3.
  • since: 11.1
  • access: public
string|function setLowerLimitSearchWordCallback (mixed $function)
  • mixed $function: Function name (string) or actual function for PHP 5.3 (function)
setPluralSuffixesCallback (line 464)

Set the pluralSuffixes function.

  • return: Function name or the actual function for PHP 5.3.
  • since: 11.1
  • access: public
mixed setPluralSuffixesCallback (mixed $function)
  • mixed $function: Function name (string) or actual function for PHP 5.3 (function)
setSearchDisplayedCharactersNumberCallback (line 656)

Setter for the searchDisplayedCharactersNumberCallback function.

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • since: 11.1
  • access: public
mixed setSearchDisplayedCharactersNumberCallback (string $function)
  • string $function: The name of the callback.
setTransliterator (line 396)

Set the transliteration function.

  • since: 11.1
  • access: public
mixed setTransliterator (mixed $function)
  • mixed $function: Function name (string) or the actual function for PHP 5.3 (function).
setUpperLimitSearchWordCallback (line 608)

Setter for the upperLimitSearchWordCallback function

  • return: Function name (string) or the actual function for PHP 5.3 (function).
  • since: 11.1
  • access: public
mixed setUpperLimitSearchWordCallback (string $function)
  • string $function: The name of the callback function.
transliterate (line 360)

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 289)

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

Inherited Methods

Inherited From JObject

JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 13:56:05 -0500 by phpDocumentor 1.4.4