Back to Joomla project (class list)

Class Language - list of methods

Languages/translation handler class
Package: Joomla\CMS\Language
Copyright: (C) 2005 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Language/Language.php
Project: Joomla

Method Summary

public
(mixed $lang = null, mixed $debug = false)

Constructor activating the default information of the language.
Parameters
  • string $lang The language
  • bool $debug Indicates if language debugging is enabled.
Since
  • 1.7.0
Show source code of this method: __construct Source Code

public static \Joomla\CMS\Language\Language
(mixed $lang, mixed $debug = false)

Returns a language object.
Parameters
  • string $lang The language to use.
  • bool $debug The debug mode.
Returns
  • \Joomla\CMS\Language\Language The Language object.
Since
  • 1.7.0
Deprecated
  • 5.0
Show source code of this method: getInstance Source Code

public string
(mixed $string, mixed $jsSafe = false, mixed $interpretBackSlashes = true)

Translate function, mimics the php gettext (alias _) function.
Parameters
  • string $string The string to translate
  • bool $jsSafe Make the result javascript safe
  • bool $interpretBackSlashes Interpret \t and \n
Returns
  • string The translation of the string
Since
  • 1.7.0
Show source code of this method: _ Source Code

public string
(mixed $string)

Transliterate function
Parameters
  • string $string The string to transliterate.
Returns
  • string The transliteration of the string.
Since
  • 1.7.0
Show source code of this method: transliterate Source Code

public callable
()

Getter for transliteration function
Returns
  • callable The transliterator function
Since
  • 1.7.0
Show source code of this method: getTransliterator Source Code

public callable
(callable $function)

Set the transliteration function.
Parameters
  • callable $function Function name or the actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0
Show source code of this method: setTransliterator Source Code

public array
(mixed $count)

Returns an array of suffixes for plural rules.
Parameters
  • int $count The count number the rule is for.
Returns
  • array The array of suffixes.
Since
  • 1.7.0
Show source code of this method: getPluralSuffixes Source Code

public callable
()

Getter for pluralSuffixesCallback function.
Returns
  • callable Function name or the actual function.
Since
  • 1.7.0
Show source code of this method: getPluralSuffixesCallback Source Code

public callable
(callable $function)

Set the pluralSuffixes function.
Parameters
  • callable $function Function name or actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0
Show source code of this method: setPluralSuffixesCallback Source Code

public array
()

Returns an array of ignored search words
Returns
  • array The array of ignored search words.
Since
  • 1.7.0
Show source code of this method: getIgnoredSearchWords Source Code

public callable
()

Getter for ignoredSearchWordsCallback function.
Returns
  • callable Function name or the actual function.
Since
  • 1.7.0
Show source code of this method: getIgnoredSearchWordsCallback Source Code

public callable
(callable $function)

Setter for the ignoredSearchWordsCallback function
Parameters
  • callable $function Function name or actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0
Show source code of this method: setIgnoredSearchWordsCallback Source Code

public int
()

Returns a lower limit integer for length of search words
Returns
  • int The lower limit integer for length of search words (3 if no value was set for a specific language).
Since
  • 1.7.0
Show source code of this method: getLowerLimitSearchWord Source Code

public callable
()

Getter for lowerLimitSearchWordCallback function
Returns
  • callable Function name or the actual function.
Since
  • 1.7.0
Show source code of this method: getLowerLimitSearchWordCallback Source Code

public callable
(callable $function)

Setter for the lowerLimitSearchWordCallback function.
Parameters
  • callable $function Function name or actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0
Show source code of this method: setLowerLimitSearchWordCallback Source Code

public int
()

Returns an upper limit integer for length of search words
Returns
  • int The upper limit integer for length of search words (200 if no value was set or if default value is < 200).
Since
  • 1.7.0
Show source code of this method: getUpperLimitSearchWord Source Code

public callable
()

Getter for upperLimitSearchWordCallback function
Returns
  • callable Function name or the actual function.
Since
  • 1.7.0
Show source code of this method: getUpperLimitSearchWordCallback Source Code

public callable
(callable $function)

Setter for the upperLimitSearchWordCallback function
Parameters
  • callable $function Function name or the actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0
Show source code of this method: setUpperLimitSearchWordCallback Source Code

public int
()

Returns the number of characters displayed in search results.
Returns
  • int The number of characters displayed (200 if no value was set for a specific language).
Since
  • 1.7.0
Show source code of this method: getSearchDisplayedCharactersNumber Source Code

public callable
()

Getter for searchDisplayedCharactersNumberCallback function
Returns
  • callable Function name or the actual function.
Since
  • 1.7.0

public callable
(callable $function)

Setter for the searchDisplayedCharactersNumberCallback function.
Parameters
  • callable $function Function name or the actual function.
Returns
  • callable The previous function.
Since
  • 1.7.0

public bool
(mixed $extension = 'joomla', mixed $basePath = JPATH_BASE, mixed $lang = null, mixed $reload = false, mixed $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.
  • bool $reload Flag that will force a language to be reloaded if set to true.
  • bool $default Flag that force the default language to be loaded if the current does not exist.
Returns
  • bool True if the file has successfully loaded.
Since
  • 1.7.0
Show source code of this method: load Source Code

protected bool
(mixed $fileName, mixed $extension = 'unknown')

Loads a language file.
Parameters
  • string $fileName The name of the file.
  • string $extension The name of the extension.
Returns
  • bool True if new strings have been added to the language
Since
  • 1.7.0
-
  • \Joomla\CMS\Language\Language::load()
Show source code of this method: loadLanguage Source Code

protected array
(mixed $fileName)

Parses a language file.
Parameters
  • string $fileName The name of the file.
Returns
  • array The array of parsed strings.
Since
  • 1.7.0
Show source code of this method: parse Source Code

public int
(mixed $filename)

Debugs a language file
Parameters
  • string $filename Absolute path to the file to debug
Returns
  • int A count of the number of parsing errors
Since
  • 3.6.3
-
  • \InvalidArgumentException
Show source code of this method: debugFile Source Code

public mixed
(mixed $property, mixed $default = null)

Get a metadata language property.
Parameters
  • string $property The name of the property.
  • mixed $default The default value.
Returns
  • mixed The value of the property.
Since
  • 1.7.0
Show source code of this method: get Source Code

protected array
()

Get a back trace.
Returns
  • array
Since
  • 4.0.0
Show source code of this method: getTrace Source Code

protected array
()

Determine who called Language or Text.
Returns
  • array Caller information.
Since
  • 1.7.0
Show source code of this method: getCallerInfo Source Code

public string
()

Getter for Name.
Returns
  • string Official name element of the language.
Since
  • 1.7.0
Show source code of this method: getName Source Code

public array
(mixed $extension = null)

Get a list of language files that have been loaded.
Parameters
  • string $extension An optional extension name.
Returns
  • array
Since
  • 1.7.0
Show source code of this method: getPaths Source Code

public array
()

Get a list of language files that are in error state.
Returns
  • array
Since
  • 1.7.0
Show source code of this method: getErrorFiles Source Code

public string
()

Getter for the language tag (as defined in RFC 3066)
Returns
  • string The language tag.
Since
  • 1.7.0
Show source code of this method: getTag Source Code

public string
()

Getter for the calendar type
Returns
  • string The calendar type.
Since
  • 3.7.0
Show source code of this method: getCalendar Source Code

public bool
()

Get the RTL property.
Returns
  • bool True is it an RTL language.
Since
  • 1.7.0
Show source code of this method: isRtl Source Code

public bool
(mixed $debug)

Set the Debug property.
Parameters
  • bool $debug The debug setting.
Returns
  • bool Previous value.
Since
  • 1.7.0
Show source code of this method: setDebug Source Code

public bool
()

Get the Debug property.
Returns
  • bool True is in debug mode.
Since
  • 1.7.0
Show source code of this method: getDebug Source Code

public string
()

Get the default language code.
Returns
  • string Language code.
Since
  • 1.7.0
Show source code of this method: getDefault Source Code

public string
(mixed $lang)

Set the default language code.
Parameters
  • string $lang The language code.
Returns
  • string Previous value.
Since
  • 1.7.0
Show source code of this method: setDefault Source Code

public array
()

Get the list of orphaned strings if being tracked.
Returns
  • array Orphaned text.
Since
  • 1.7.0
Show source code of this method: getOrphans Source Code

public array
()

Get the list of used strings.
Returns
  • array Used strings.
Since
  • 1.7.0
Show source code of this method: getUsed Source Code

public bool
(mixed $string)

Determines is a key exists.
Parameters
  • string $string The key to check.
Returns
  • bool True, if the key exists.
Since
  • 1.7.0
Show source code of this method: hasKey Source Code

public array
()

Get the language locale based on current language.
Returns
  • array The locale according to the language.
Since
  • 1.7.0
Show source code of this method: getLocale Source Code

public int
()

Get the first day of the week for this language.
Returns
  • int The first day of the week according to the language
Since
  • 1.7.0
Show source code of this method: getFirstDay Source Code

public string
()

Get the weekends days for this language.
Returns
  • string The weekend days of the week separated by a comma according to the language
Since
  • 3.2
Show source code of this method: getWeekEnd Source Code

Properties Summary

protected static \Joomla\CMS\Language\Language[]
$languages
Array of Language objects
Since
  • 1.7.0
protected bool
$debug
Debug language, If true, highlights if string isn't found.
Since
  • 1.7.0
protected string
$default
The default language, used when a language file in the requested language does not exist.
Since
  • 1.7.0
protected array
$orphans
An array of orphaned text.
Since
  • 1.7.0
protected array
$metadata
Array holding the language metadata.
Since
  • 1.7.0
protected array|bool
$locale
Array holding the language locale or boolean null if none.
Since
  • 1.7.0
protected string
$lang
The language to load.
Since
  • 1.7.0
protected array
$paths
A nested array of language files that have been loaded
Since
  • 1.7.0
protected array
$errorfiles
List of language files that are in error state
Since
  • 1.7.0
protected array
$strings
Translations
Since
  • 1.7.0
protected array
$used
An array of used text, used during debugging.
Since
  • 1.7.0
protected int
$counter
Counter for number of loads.
Since
  • 1.7.0
protected array
$override
An array used to store overrides.
Since
  • 1.7.0
protected string
$transliterator
Name of the transliterator function for this language.
Since
  • 1.7.0
protected callable
$pluralSuffixesCallback
Name of the pluralSuffixesCallback function for this language.
Since
  • 1.7.0
protected callable
$ignoredSearchWordsCallback
Name of the ignoredSearchWordsCallback function for this language.
Since
  • 1.7.0
protected callable
$lowerLimitSearchWordCallback
Name of the lowerLimitSearchWordCallback function for this language.
Since
  • 1.7.0
protected callable
$upperLimitSearchWordCallback
Name of the upperLimitSearchWordCallback function for this language.
Since
  • 1.7.0
protected callable
$searchDisplayedCharactersNumberCallback
Name of the searchDisplayedCharactersNumberCallback function for this language.
Since
  • 1.7.0

Tags Summary

Since
1.7.0