Localization

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Localization
Since
3.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

Signature

public static void findMissingTranslation ( yii\i18n\MissingTranslationEvent $event )

localeData()

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

View source

Arguments

Returns

array, null

Signature

public static array, null localeData ( \craft\helpers\string $localeId )

normalizeLanguage()

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

View source

Arguments

Returns

string

Throws

Signature

public static string normalizeLanguage ( \craft\helpers\string $language )

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.

Signature

public static mixed normalizeNumber ( $number, \craft\helpers\string $localeId = null )