Support Joomla!

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 Class JLanguage

Description

Languages/translation handler class

  • since: 1.5

Located in /joomla/language/language.php (line 25)

Class JObject   (Subpackage Base)

Class JLanguage   (Subpackage Language)
Variable Summary
Variable boolean $_debug
Variable string $_default
Variable string $_lang
Variable array $_metadata
Variable array $_orphans
Variable array $_paths
Variable array $_strings
Variable array $_used
Method Summary
Constructor JLanguage __construct ([ $lang = null])
Method boolean exists (string $lang, [string $basePath = JPATH_BASE])
Method mixed get (string $property, [mixed $default = null])
Method string getBackwardLang ()
Method boolean getDebug ()
Method string getDefault ()
Method JLanguage &getInstance (string $lang)
Method array getKnownLanguages ([string $basePath = JPATH_BASE])
Method string getLanguagePath ([string $basePath = JPATH_BASE], [string $language = null])
Method string getLocale ()
Method mixed getMetadata (string $lang)
Method string getName ()
Method array getOrphans ()
Method array getPaths ([string $extension = null])
Method string getPdfFontName ()
Method string getTag ()
Method array getUsed ()
Method string getWinCP ()
Method boolean hasKey (key $key)
Method boolean isRTL ()
Method boolean load ([string $extension = 'joomla'], [string $basePath = JPATH_BASE], [string $lang = null], [boolean $reload = false])
Method boolean setDebug ( $debug)
Method string setDefault ( $lang)
Method string setLanguage (string $lang)
Method string transliterate (string $string)
Method string _ (string $string, [boolean $jsSafe = false])
Method array _parseLanguageFiles ([string $dir = null])
Method array _parseXMLLanguageFile (string $path)
Method array _parseXMLLanguageFiles ([string $dir = null])
Variables
boolean $_debug = false (line 34)

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

  • since: 1.5
  • access: protected
string $_default = 'en-GB' (line 45)

The default language

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

  • since: 1.5
  • access: protected
string $_lang = null (line 72)

The language to load

  • since: 1.5
  • access: protected
array $_metadata = null (line 63)

Array holding the language metadata

  • since: 1.5
  • access: protected
array $_orphans = array() (line 54)

An array of orphaned text

  • since: 1.5
  • access: protected
array $_paths = array() (line 81)

List of language files that have been loaded

  • var: of arrays
  • since: 1.5
  • access: public
array $_strings = null (line 90)

Translations

  • since: 1.5
  • access: protected
array $_used = array() (line 99)

An array of used text, used during debugging

  • since: 1.5
  • access: protected

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 106)

Constructor activating the default information of the language

  • access: protected
JLanguage __construct ([ $lang = null])
  • $lang

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

Check 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: 1.5
  • access: public
boolean exists (string $lang, [string $basePath = JPATH_BASE])
  • string $lang: Language to check
  • string $basePath: Optional path to check
get (line 377)

Get a matadata language property

  • return: The value of the property
  • since: 1.5
  • 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.
getBackwardLang (line 489)

Getter for backward compatible language name

  • return: backward compatible name
  • since: 1.5
  • access: public
string getBackwardLang ()
getDebug (line 556)

Get the Debug property

  • return: True is in debug mode
  • since: 1.5
  • access: public
boolean getDebug ()
getDefault (line 567)

Get the default language code

  • return: Language code
  • since: 1.5
  • access: public
string getDefault ()
getInstance (line 130)

Returns a reference to a language object

This method must be invoked as:

  $browser = &JLanguage::getInstance([$lang);

  • return: The Language object.
  • since: 1.5
  • access: public
JLanguage &getInstance (string $lang)
  • string $lang: The language to use.
getKnownLanguages (line 651)

Returns a list of known languages for an area

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

Get the path to a language

  • return: language related path or null
  • since: 1.5
  • access: public
string getLanguagePath ([string $basePath = JPATH_BASE], [string $language = null])
  • string $basePath: The basepath to use
  • string $language: The language tag
getLocale (line 511)

Get locale property

  • return: The locale property
  • since: 1.5
  • access: public
string getLocale ()
getMetadata (line 630)

Returns a associative array holding the metadata

  • return: If $lang exists return key/value pair with the language metadata, otherwise return NULL
  • since: 1.5
  • access: public
mixed getMetadata (string $lang)
  • string $lang: The name of the language
getName (line 433)

Getter for Name

  • return: Official name element of the language
  • since: 1.5
  • access: public
string getName ()
getOrphans (line 591)

Get the list of orphaned strings if being tracked

  • return: Orphaned text
  • since: 1.5
  • access: public
array getOrphans ()
getPaths (line 445)

Get a list of language files that have been loaded

  • since: 1.5
  • access: public
array getPaths ([string $extension = null])
  • string $extension: An option extension name
getPdfFontName (line 467)

Getter for PDF Font Name

  • return: name of pdf font to be used
  • since: 1.5
  • access: public
string getPdfFontName ()
getTag (line 500)

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

  • return: The language tag
  • since: 1.5
  • access: public
string getTag ()
getUsed (line 604)

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: 1.5
  • access: public
array getUsed ()
getWinCP (line 478)

Getter for Windows locale code page

  • return: windows locale encoding
  • since: 1.5
  • access: public
string getWinCP ()
hasKey (line 616)

Determines is a key exists

  • return: True, if the key exists
  • since: 1.5
  • access: public
boolean hasKey (key $key)
  • key $key: The key to check
isRTL (line 532)

Get the RTL property

  • return: True is it an RTL language
  • since: 1.5
  • access: public
boolean isRTL ()
load (line 281)

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

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

Set the Debug property

  • return: Previous value
  • since: 1.5
  • access: public
boolean setDebug ( $debug)
  • $debug
setDefault (line 578)

Set the default language code

  • return: Previous value
  • since: 1.5
  • access: public
string setDefault ( $lang)
  • $lang
setLanguage (line 687)

Set the language attributes to the given language

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

  • return: Previous value
  • since: 1.5
  • access: public
string setLanguage (string $lang)
  • string $lang: Language code
transliterate (line 223)

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: 1.5
  • access: public
string transliterate (string $string)
  • string $string: The string to transliterate
_ (line 146)

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

  • return: The translation of the string
  • since: 1.5
  • access: public
string _ (string $string, [boolean $jsSafe = false])
  • string $string: The string to translate
  • boolean $jsSafe: Make the result javascript safe
_parseLanguageFiles (line 707)

Searches for language directories within a certain base dir

  • return: Array holding the found languages as filename => real name pairs
  • since: 1.5
  • access: public
array _parseLanguageFiles ([string $dir = null])
  • string $dir: directory of files
_parseXMLLanguageFile (line 758)

Parse XML file for language information

  • return: Array holding the found metadata as a key => value pair
  • since: 1.5
  • access: public
array _parseXMLLanguageFile (string $path)
  • string $path: Path to the xml files
_parseXMLLanguageFiles (line 730)

Parses XML files for language information

  • return: Array holding the found languages as filename => metadata array
  • since: 1.5
  • access: public
array _parseXMLLanguageFiles ([string $dir = null])
  • string $dir: Directory of files

Inherited Methods

Inherited From JObject

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

Documentation generated on Sat, 14 Nov 2009 11:15:25 +0000 by phpDocumentor 1.3.1