The goog.i18n.currency Namespace

.CurrencyInfo {!Object.<!Array>}

Tier 1 currency information.

.CurrencyInfoTier2 {!Object.<!Array>}

Tier 2 currency information.

.addTier2Support()

This function will add tier2 currency support. Be default, only tier1 (most popular currencies) are supportted. If an application really need to support some of the rarely used currency, it should call this function before any other functions in this namespace.

.adjustPrecision(pattern, currencyCode)

Modify currency pattern string by adjusting precision for given currency. Standard currency pattern will have 2 digit after decimal point. Examples: $#,##0.00 -> $#,##0 (precision == 0) $#,##0.00 -> $#,##0.0 (precision == 1) $#,##0.00 -> $#,##0.000 (precision == 3)

pattern {string}
currency pattern string.
currencyCode {string}
3-letter currency code.
returns {string}
modified currency pattern string.

.getGlobalCurrencyPattern(currencyCode)

Global currency pattern always uses ISO-4217 currency code as prefix. Local currency sign is added if it is different from currency code. Each currency is unique in this form. The negative side is that ISO code looks weird in some countries as poeple normally do not use it. Local currency sign alleviate the problem, but also make it a little verbose.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Global currency pattern string for given currency.

.getGlobalCurrencySign(currencyCode)

Return global currency sign string for those applications that want to handle currency sign themselves.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Global currency sign for given currency.

.getLocalCurrencyPattern(currencyCode)

Local currency pattern is the most frequently used pattern in currency's native region. It does not care about how it is distinguished from other currencies.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Local currency pattern string for given currency.

.getLocalCurrencySign(currencyCode)

Returns local currency sign string for those applications that need to handle currency sign separately.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Local currency sign for given currency.

.getPortableCurrencyPattern(currencyCode)

Portable currency pattern is a compromise between local and global. It is not a mere blend or mid-way between the two. Currency sign is chosen so that it looks familiar to native users. It also has enough information to distinguish itself from other popular currencies in its native region. In this pattern, currency sign symbols that has availability problem in popular fonts are also avoided.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Portable currency pattern string for given currency.

.getPortableCurrencySign(currencyCode)

Return portable currency sign string for those applications that need to handle currency sign themselves.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {string}
Portable currency sign for given currency.

.isPrefixSignPosition(currencyCode)

This function returns the default currency sign position. Some application may want to handle currency sign and currency amount separately. This function can be used in such situation to position the currency sign relative to amount field correctly. To match the behavior of ICU, position is not determined by display locale. This method will always return true for now (because of the change of data) and should be avoided if possible.

currencyCode {string}
ISO-4217 3-letter currency code.
returns {boolean}
true if currency should be positioned before amount field.