Localization

Type
Abstract Class
Namespace
craft\commerce\helpers
Inherits
craft\commerce\helpers\Localization » craft\helpers\Localization (opens new window)
Since
3.4.10

Localization Helper

View source (opens new window)

# Public Methods

Method Description
findMissingTranslation() (opens new window) Looks for a missing translation string in Yii's core translations.
formatAsPercentage() Return value as a percentage.
localeData() (opens new window) Returns fallback data for a locale if the Intl extension isn't loaded.
normalizeLanguage() (opens new window) Normalizes a language into the correct format (e.g. en-US).
normalizeNumber() (opens new window) Normalizes a user-submitted number for use in code and/or to be saved into the database.
normalizePercentage() Normalizes a percentage value into a float.

# formatAsPercentage()

DEPRECATED

Deprecated in 3.4.10. This is only used as a stopgap until craft\i18n\Formatter::asDecimal() supports dynamic decimals in Craft 4

Return value as a percentage.

Decimal precision is dynamically calculated when $decimals is null.

View source (opens new window)

Arguments

Returns

string (opens new window) – The formatted result.

# normalizePercentage()

Normalizes a percentage value into a float.

View source (opens new window)

Arguments

Returns

float (opens new window)