Méthode |
Description |
|
__construct ( ) |
Initializes new translator |
|
addTranslation ( string $country_code, array $language_array ) : boolean |
Add a translation. |
|
detectLanguage ( ) : string |
Detect the current system/user language or false. |
|
getAllLanguageCodes ( ) : array |
Returns an array of language codes. |
|
getCurrentLanguage ( ) : string |
Get the current system/user language or "en". |
|
getInstalledTranslations ( ) : array |
Return an array of installed translations as an associative
array "two letter code" => "native language name". |
|
getLanguageCompleteness ( string $language ) : integer |
Return the level of completeness for a given language code (compared to english) |
|
getMissingLanguageKeys ( string $language ) : mixed |
Return the translation keys missing from a given language,
or those that are identical to the english version. |
|
languageKeyExists ( string $key, string $language = 'en' ) : boolean |
Check if a given language key exists |
|
loadTranslations ( string $language = null ) |
Load both core and plugin translations |
|
normalizeLanguageCode ( string $code ) : string |
Normalize a language code (e.g. from Transifex) |
|
registerPluginTranslations ( string $path ) : boolean |
Registers translations in a directory assuming the standard plugin layout. |
|
registerTranslations ( string $path, boolean $load_all = false, string $language = null ) : boolean |
When given a full path, finds translation files and loads them |
|
reloadAllTranslations ( ) : void |
Reload all translations from all registered paths. |
|
translate ( string $message_key, array $args = [], string $language = "" ) : string |
Given a message key, returns an appropriately translated full-text string |
|