Свойство | Type | Description | |
---|---|---|---|
$category | string | Current category of translation | |
$defaultDomain | string | Default domain of translation | |
$domain | string | Current domain of translation | |
$l10n | L10n | Instance of the L10n class for localization |
Свойство | Type | Description | |
---|---|---|---|
$_categories | array | Translation categories | |
$_domains | array | Translation strings for a specific domain read from the .mo or .po files | |
$_escape | string | Escape string | |
$_lang | string | Current language used for translations | |
$_noLocale | boolean | If a translation file is found it is set to false again |
Méthode | Description | |
---|---|---|
__construct ( ) | Constructor, use I18n::getInstance() to get the i18n translation object. | |
clear ( ) : void | Clears the domains internal data array. Useful for testing i18n. | |
domains ( ) : array | Get the loaded domains cache. | |
getInstance ( ) : I18n | Return a static instance of the I18n class | |
insertArgs ( string $translated, array $args ) : string | Puts the parameters in raw translated strings | |
loadLocaleDefinition ( string $filename ) : mixed | Parses a locale definition file following the POSIX standard | |
loadMo ( string $filename ) : mixed | Loads the binary .mo file and returns array of translations | |
loadPo ( string $filename ) : mixed | Loads the text .po file and returns array of translations | |
translate ( string $singular, string $plural = null, string $domain = null, string $category = self::LC_MESSAGES, integer $count = null, string $language = null, string $context = null ) : string | Used by the translation functions in basics.php Returns a translated string based on current language and translation files stored in locale folder |
Méthode | Description | |
---|---|---|
_bindTextDomain ( string $domain ) : string | Binds the given domain to a file in the specified directory. | |
_parseLiteralValue ( string $string ) : string | Auxiliary function to parse a symbol from a locale definition file | |
_pluralGuess ( string $header, integer $n ) : integer | Attempts to find the plural form of a string. | |
_translateTime ( string $format, string $domain ) : mixed | Returns a Time format definition from corresponding domain |
public __construct ( ) |
protected _bindTextDomain ( string $domain ) : string | ||
$domain | string | Domain to bind |
Résultat | string | Domain binded |
protected _parseLiteralValue ( string $string ) : string | ||
$string | string | Symbol to be parsed |
Résultat | string | parsed symbol |
public static getInstance ( ) : I18n | ||
Résultat | I18n |
public static loadLocaleDefinition ( string $filename ) : mixed | ||
$filename | string | Locale definition filename |
Résultat | mixed | Array of definitions on success or false on failure |
public static translate ( string $singular, string $plural = null, string $domain = null, string $category = self::LC_MESSAGES, integer $count = null, string $language = null, string $context = null ) : string | ||
$singular | string | String to translate |
$plural | string | Plural string (if any) |
$domain | string | Domain The domain of the translation. Domains are often used by plugin translations. If null, the default domain will be used. |
$category | string | Category The integer value of the category to use. |
$count | integer | Count Count is used with $plural to choose the correct plural form. |
$language | string | Language to translate string to. If null it checks for language in session followed by Config.language configuration variable. |
$context | string | Context The context of the translation, e.g a verb or a noun. |
Résultat | string | translated string. |
protected array $_categories | ||
Résultat | array |
protected array $_domains | ||
Résultat | array |
protected string $_lang | ||
Résultat | string |
protected bool $_noLocale | ||
Résultat | boolean |
public string $category | ||
Résultat | string |
public static string $defaultDomain | ||
Résultat | string |