|
Elgg
Version 1.10
|
Public Member Functions | |
| __construct () | |
| Initializes new translator. More... | |
| translate ($message_key, $args=array(), $language="") | |
| Given a message key, returns an appropriately translated full-text string. More... | |
| addTranslation ($country_code, $language_array) | |
| Add a translation. More... | |
| getCurrentLanguage () | |
| Detect the current language being used by the current site or logged in user. More... | |
| getLanguage () | |
| Gets the current language in use by the system or user. More... | |
| loadTranslations () | |
| @access private More... | |
| registerTranslations ($path, $load_all=false) | |
| When given a full path, finds translation files and loads them. More... | |
| reloadAllTranslations () | |
| Reload all translations from all registered paths. More... | |
| getInstalledTranslations () | |
| Return an array of installed translations as an associative array "two letter code" => "native language name". More... | |
| getLanguageCompleteness ($language) | |
| Return the level of completeness for a given language code (compared to english) More... | |
| getMissingLanguageKeys ($language) | |
| Return the translation keys missing from a given language, or those that are identical to the english version. More... | |
Definition at line 13 of file Translator.php.
| Elgg\I18n\Translator::__construct | ( | ) |
Initializes new translator.
Definition at line 25 of file Translator.php.
| Elgg\I18n\Translator::addTranslation | ( | $country_code, | |
| $language_array | |||
| ) |
Add a translation.
Translations are arrays in the Zend Translation array format, eg:
$english = array('message1' => 'message1', 'message2' => 'message2'); $german = array('message1' => 'Nachricht1','message2' => 'Nachricht2');
| string | $country_code | Standard country code (eg 'en', 'nl', 'es') |
| array | $language_array | Formatted array of strings |
Definition at line 110 of file Translator.php.
| Elgg\I18n\Translator::getCurrentLanguage | ( | ) |
Detect the current language being used by the current site or logged in user.
Definition at line 136 of file Translator.php.
| Elgg\I18n\Translator::getInstalledTranslations | ( | ) |
Return an array of installed translations as an associative array "two letter code" => "native language name".
Definition at line 307 of file Translator.php.
| Elgg\I18n\Translator::getLanguage | ( | ) |
Gets the current language in use by the system or user.
Definition at line 151 of file Translator.php.
| Elgg\I18n\Translator::getLanguageCompleteness | ( | $language | ) |
Return the level of completeness for a given language code (compared to english)
| string | $language | Language |
Definition at line 335 of file Translator.php.
| Elgg\I18n\Translator::getMissingLanguageKeys | ( | $language | ) |
Return the translation keys missing from a given language, or those that are identical to the english version.
| string | $language | The language |
Definition at line 366 of file Translator.php.
| Elgg\I18n\Translator::loadTranslations | ( | ) |
@access private
Definition at line 173 of file Translator.php.
| Elgg\I18n\Translator::registerTranslations | ( | $path, | |
$load_all = false |
|||
| ) |
When given a full path, finds translation files and loads them.
| string | $path | Full path |
| bool | $load_all | If true all languages are loaded, if false only the current language + en are loaded |
Definition at line 211 of file Translator.php.
| Elgg\I18n\Translator::reloadAllTranslations | ( | ) |
Reload all translations from all registered paths.
This is only called by functions which need to know all possible translations.
Definition at line 268 of file Translator.php.
| Elgg\I18n\Translator::translate | ( | $message_key, | |
$args = array(), |
|||
$language = "" |
|||
| ) |
Given a message key, returns an appropriately translated full-text string.
| string | $message_key | The short message code |
| array | $args | An array of arguments to pass through vsprintf(). |
| string | $language | Optionally, the standard language code (defaults to site/user default, then English) |
Reimplemented in Elgg\I18n\NullTranslator.
Definition at line 42 of file Translator.php.