Craft 3 Class Reference

Class craft\helpers\Localization

Inheritance
craft\helpers\Localization
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/helpers/Localization.php

Class Localization

Public Methods
Method Description Defined By
findMissingTranslation() Looks for a missing translation string in Yii's core translations. craft\helpers\Localization
localeData() Returns fallback data for a locale if the Intl extension isn't loaded. craft\helpers\Localization
normalizeLanguage() Normalizes a language into the correct format (e.g. en-US). craft\helpers\Localization
normalizeNumber() Normalizes a user-submitted number for use in code and/or to be saved into the database. craft\helpers\Localization

Method Details

findMissingTranslation() public static method #

Looks for a missing translation string in Yii's core translations.

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

localeData() public static method #

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

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

normalizeLanguage() public static method #

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

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

normalizeNumber() public static method #

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.

public static mixed normalizeNumber ( $number, \craft\helpers\string $localeId null )
$number mixed The number that should be normalized.
$localeId string, null The locale ID that the number is set in
return mixed The normalized number.