static init |
( |
?string |
$code = 'en' | ) |
|
|
static |
L10N initialization
Create global arrays for L10N stuff. Should be called before any work with other methods. For plural-forms, __l10n values can now be array.
- Parameters
-
string | null | $code | Language code to work with |
Referenced by Wizard\init(), Install\init(), and Task\run().
static lang |
( |
?string |
$code = null | ) |
|
|
static |
Set a language to work on or return current working language code
This set up language properties to manage plurals form. Change of language code not reset global array of L10N stuff.
- Parameters
-
- Returns
- string Current language code
Referenced by Lang\setLang().
static trans |
( |
string |
$singular, |
|
|
?string |
$plural = null , |
|
|
?int |
$count = null |
|
) |
| |
|
static |
Translate a string
Returns a translated string of $singular or $plural according to a number if it is set. If translation is not found, returns the string.
- Parameters
-
string | $singular | Singular form of the string |
string | $plural | Plural form of the string (optionnal) |
integer | $count | Context number for plural form (optionnal) |
- Returns
- string Translated string
static index |
( |
int |
$count | ) |
|
|
static |
Retrieve plural index from input number
- Parameters
-
integer | $count | Number to take account |
- Returns
- integer Index of plural form
static set |
( |
string |
$file | ) |
|
|
static |
static getFilePath |
( |
string |
$dir, |
|
|
string |
$file, |
|
|
string |
$lang |
|
) |
| |
|
static |
L10N file
Returns a file path for a file, a directory and a language. If $dir/$lang/$file is not found, it will check if $dir/en/$file exists and returns the result. Returns false if no file were found.
- Parameters
-
string | $dir | Directory |
string | $file | File |
string | $lang | Language |
- Returns
- string|false File path or false
Referenced by Modules\loadModuleL10Nresources(), Digests\process(), and Utility\process().
static getPoFile |
( |
string |
$file | ) |
|
|
static |
Load gettext file
Returns an array of strings found in a given gettext (.po) file
- Parameters
-
- Returns
- array<mixed>|false
static generatePhpFileFromPo |
( |
string |
$file, |
|
|
string |
$license_block = '' |
|
) |
| |
|
static |
Generates a PHP file from a po file
Return a boolean depending on success or failure
- Parameters
-
string | $file | File |
string | $license_block | Optional license block to add at the beginning |
- Returns
- bool true on success
References L10n\$locales.
static cleanPoLine |
( |
string |
$type, |
|
|
|
$_ |
|
) |
| |
|
staticprotected |
Clean line from .po
- Parameters
-
string | $type | The type |
mixed | $_ | the line |
- Returns
- false|array<string>
static cleanPoString |
( |
|
$_ | ) |
|
|
staticprotected |
Clean string from .po
- Parameters
-
- Returns
- string
static parsePluralExpression |
( |
string |
$expression | ) |
|
|
static |
Extract nplurals and plural from po expression
- Parameters
-
string | $expression | Plural form as of gettext Plural-form param |
- Returns
- array<int, int|string> Number of plurals and cleaned plural expression
static createPluralFunction |
( |
int |
$nplurals, |
|
|
string |
$expression |
|
) |
| |
|
static |
Create function to find plural msgstr index from gettext expression
- Parameters
-
integer | $nplurals | Plurals number |
string | $expression | Plural expression |
- Returns
- callable Function to extract right plural index
static cleanPluralExpression |
( |
string |
$_ | ) |
|
|
staticprotected |
static isCode |
( |
string |
$code | ) |
|
|
static |
Check if a language code exists
- Parameters
-
- Returns
- bool True if code exists
static getCode |
( |
string |
$code | ) |
|
|
static |
Get a language code according to a language name
- Parameters
-
- Returns
- string Language code
static getISOcodes |
( |
bool |
$flip = false , |
|
|
bool |
$name_with_code = false |
|
) |
| |
|
static |
static getLanguageName |
( |
string |
$code | ) |
|
|
static |
static getLanguagesName |
( |
| ) |
|
|
static |
Get languages names
- Returns
- array<string, string> List of languages names by languages codes
static getLanguageTextDirection |
( |
string |
$code | ) |
|
|
static |
Get a text direction according to a language code
- Parameters
-
- Returns
- string Text direction (rtl or ltr)
Referenced by Page\openPopup().
static getLanguagesTextDirection |
( |
| ) |
|
|
static |
Get languages text directions
- Returns
- array<string, string> List of text directions by languages codes
static getLanguagePluralsNumber |
( |
string |
$code | ) |
|
|
static |
Get a number of plurals according to a language code
- Parameters
-
- Returns
- int Number of plurals
static getLanguagesPluralsNumber |
( |
| ) |
|
|
static |
Get languages numbers of plurals
- Returns
- array<string, int|null> List of numbers of plurals by languages codes
static getLanguagePluralExpression |
( |
string |
$code | ) |
|
|
static |
Get a plural expression according to a language code
- Parameters
-
- Returns
- string Plural expression
static getLanguagesPluralExpression |
( |
| ) |
|
|
static |
Get languages plural expressions
- Returns
- array<string, string|null> List of plural expressions by languages codes
array $languages_definitions = [] |
|
staticprotected |
array $languages_textdirection |
|
staticprotected |
array $languages_pluralsnumber |
|
staticprotected |
array $languages_pluralexpression |
|
staticprotected |
string $language_code = null |
|
staticprotected |
string $language_textdirection |
|
staticprotected |
int $language_pluralsnumber |
|
staticprotected |
string $language_pluralexpression |
|
staticprotected |
The documentation for this class was generated from the following file: