Skip to content

Localization ​

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Localization
Since
3.0.0

Class Localization

View source

Public Methods ​

MethodDescription
findMissingTranslation()Looks for a missing translation string in Yii's core translations.
localeData()Returns fallback data for a locale if the Intl extension isn't loaded.
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.

View source

Arguments ​

localeData() ​

Returns fallback data for a locale if the Intl extension isn't loaded.

View source

Arguments ​

Returns ​

array, null

normalizeLanguage() ​

Normalizes a language into the correct format (e.g. en-US).

View source

Arguments ​

Returns ​

string

Throws ​

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.

View source

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.