Localization ​
- Type
- Class
- Namespace
- craft\helpers
- Inherits
- craft\helpers\Localization
- Since
- 3.0.0
Class Localization
Public Methods ​
Method | Description |
---|---|
findMissingTranslation() | Looks for a missing translation string in Yii's core translations. |
normalizeLanguage() | Normalizes a language into the correct format (e.g. en-US ). |
normalizeNumber() | Normalizes a user-submitted number for use in code and/or to be saved into the database. |
findMissingTranslation()
​
Looks for a missing translation string in Yii's core translations.
Arguments ​
$event
(yii\i18n\MissingTranslationEvent)
normalizeLanguage()
​
Normalizes a language into the correct format (e.g. en-US
).
Arguments ​
$language
(string)
Returns ​
Throws ​
- yii\base\InvalidArgumentException
if $language is invalid.
normalizeNumber()
​
Normalizes a user-submitted number for use in code and/or to be saved into the database.
Group symbols are removed (e.g. 1,000,000 => 1000000), and decimals are converted to a periods, if the current locale uses something else.
Arguments ​
$number
(mixed
) – The number that should be normalized.$localeId
(string, null) – The locale ID that the number is set in
Returns ​
mixed
– The normalized number.