I18n
class I18n
Internationalization class.
Properties
protected LoaderInterface | $loader | Language loader. | |
protected string | $language | Current language. | |
protected array | $strings | Loaded language strings. | |
protected array | $inflections | Loaded language inflections. | |
protected StoreInterface | $cache | Cache instance. | |
protected bool | $rebuildCache | Should we rebuild the cache? |
Methods
Destructor.
Returns the language loader.
Gets the current language.
Sets the current language.
Loads inflection closure and rules.
Returns the plural form of a noun.
Format number according to locale or desired format.
Loads language strings from cache.
Loads all strings for the language.
Parses the language key.
Returns the language string.
Returns TRUE if the string exists and FALSE if not.
Pluralize words between pluralization tags.
Format numbers between number tags.
Parses tags.
Returns the chosen string from the current language.
Details
at line 78
__construct(LoaderInterface $loader, string $language, StoreInterface $cache = null)
Constructor.
at line 90
__destruct()
Destructor.
at line 106
LoaderInterface
getLoader()
Returns the language loader.
at line 116
setCache(StoreInterface $cache)
Sets the cache.
at line 126
string
getLanguage()
Gets the current language.
at line 136
setLanguage(string $language = null)
Sets the current language.
at line 146
protected
loadInflection(string $language)
Loads inflection closure and rules.
at line 159
string
pluralize(string $word, int $count = null, string $language = null)
Returns the plural form of a noun.
at line 187
string
number(float $number, int $decimals = 0, string $decimalPoint = null, string $thousandsSeparator = null)
Format number according to locale or desired format.
at line 212
protected bool
loadFromCache(string $language, string $file)
Loads language strings from cache.
at line 225
protected
loadStrings(string $language, string $file)
Loads all strings for the language.
at line 246
protected array
parseKey(string $key)
Parses the language key.
at line 258
protected string
getString(string $key, string $language = null)
Returns the language string.
at line 284
bool
has(string $key, string $language = null)
Returns TRUE if the string exists and FALSE if not.
at line 309
protected string
parsePluralizationTags(string $string)
Pluralize words between pluralization tags.
at line 323
protected string
parseNumberTags(string $string)
Format numbers between number tags.
at line 337
protected string
parseTags(string $string)
Parses tags.
at line 360
string
get(string $key, array $vars = [], string $language = null)
Returns the chosen string from the current language.