Home

Library goog.i18n.currency

Function Summary
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(string pattern, string currencyCode) ⇒ string

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)

getCurrencyPattern_(number patternNum, string sign) ⇒ string

This function construct the currency pattern. Currency sign is provided. The pattern information is encoded in patternNum.

getGlobalCurrencyPattern(string currencyCode) ⇒ string

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.

getGlobalCurrencySign(string currencyCode) ⇒ string

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

getLocalCurrencyPattern(string currencyCode) ⇒ string

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.

getLocalCurrencySign(string currencyCode) ⇒ string

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

getPortableCurrencyPattern(string currencyCode) ⇒ string

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.

getPortableCurrencySign(string currencyCode) ⇒ string

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

isPrefixSignPosition(string currencyCode) ⇒ boolean

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.