@@ -65,6 +65,21 @@ goog.i18n.currency.SPACE_FLAG_ = 0x20;
6565goog . i18n . currency . tier2Enabled_ = false ;
6666
6767
68+ /**
69+ * Tests if currency is available.
70+ *
71+ * Note: If the currency is not available it might be in the tier2 currency set:
72+ * {@link goog.i18n.currency.CurrencyInfoTier2}. If that is the case call
73+ * {@link goog.i18n.currency.addTier2Support} before calling any other function
74+ * in this namespace.
75+ *
76+ * @param {string } currencyCode Currency code to tested.
77+ * @return {boolean } If the currency is available.
78+ */
79+ goog . i18n . currency . isAvailable = function ( currencyCode ) {
80+ return currencyCode in goog . i18n . currency . CurrencyInfo ;
81+ } ;
82+
6883/**
6984 * This function will add tier2 currency support. Be default, only tier1
7085 * (most popular currencies) are supported. If an application really needs
@@ -84,6 +99,7 @@ goog.i18n.currency.addTier2Support = function() {
8499
85100
86101/**
102+ * Deprecated.
87103 * Global currency pattern always uses ISO-4217 currency code as prefix. Local
88104 * currency sign is added if it is different from currency code. Each currency
89105 * is unique in this form. The negative side is that ISO code looks weird in
@@ -92,6 +108,9 @@ goog.i18n.currency.addTier2Support = function() {
92108 *
93109 * @param {string } currencyCode ISO-4217 3-letter currency code.
94110 * @return {string } Global currency pattern string for given currency.
111+ * @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
112+ * {@link goog.i18n.NumberFormat.Format.CURRENCY} and
113+ * {@link goog.i18n.NumberFormat.CurrencyStyle.GLOBAL}
95114 */
96115goog . i18n . currency . getGlobalCurrencyPattern = function ( currencyCode ) {
97116 var info = goog . i18n . currency . CurrencyInfo [ currencyCode ] ;
@@ -119,12 +138,16 @@ goog.i18n.currency.getGlobalCurrencySign = function(currencyCode) {
119138
120139
121140/**
141+ * Deprecated.
122142 * Local currency pattern is the most frequently used pattern in currency's
123143 * native region. It does not care about how it is distinguished from other
124144 * currencies.
125145 *
126146 * @param {string } currencyCode ISO-4217 3-letter currency code.
127147 * @return {string } Local currency pattern string for given currency.
148+ * @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
149+ * {@link goog.i18n.NumberFormat.Format.CURRENCY} and
150+ * {@link goog.i18n.NumberFormat.CurrencyStyle.LOCAL}
128151 */
129152goog . i18n . currency . getLocalCurrencyPattern = function ( currencyCode ) {
130153 var info = goog . i18n . currency . CurrencyInfo [ currencyCode ] ;
@@ -145,6 +168,7 @@ goog.i18n.currency.getLocalCurrencySign = function(currencyCode) {
145168
146169
147170/**
171+ * Deprecated.
148172 * Portable currency pattern is a compromise between local and global. It is
149173 * not a mere blend or mid-way between the two. Currency sign is chosen so that
150174 * it looks familiar to native users. It also has enough information to
@@ -154,6 +178,9 @@ goog.i18n.currency.getLocalCurrencySign = function(currencyCode) {
154178 *
155179 * @param {string } currencyCode ISO-4217 3-letter currency code.
156180 * @return {string } Portable currency pattern string for given currency.
181+ * @deprecated Format numbers using {@link goog.i18n.NumberFormat} with
182+ * {@link goog.i18n.NumberFormat.Format.CURRENCY} and
183+ * {@link goog.i18n.NumberFormat.CurrencyStyle.PORTABLE}
157184 */
158185goog . i18n . currency . getPortableCurrencyPattern = function ( currencyCode ) {
159186 var info = goog . i18n . currency . CurrencyInfo [ currencyCode ] ;
@@ -174,12 +201,17 @@ goog.i18n.currency.getPortableCurrencySign = function(currencyCode) {
174201
175202
176203/**
177- * This function returns the default currency sign position. Some applications
204+ * This function returns the default currency sign's position. Some applications
178205 * may want to handle currency sign and currency amount separately. This
179206 * function can be used in such situations to correctly position the currency
180207 * sign relative to the amount.
181208 *
182- * To match the behavior of ICU, position is not determined by display locale.
209+ * Use {@link goog.i18n.NumberFormat#isCurrencyCodeBeforeValue} for a locale
210+ * aware version of this API (recommended). isPrefixSignPosition() returns the
211+ * default currency sign's position in the currency's default locale (e.g. 'en'
212+ * for 'USD'), but most commonly the position is needed for the locale in which
213+ * the number is going to be displayed. For example, in 'fr' 10.10 USD would be
214+ * displayed as '10,10 $'.
183215 *
184216 * @param {string } currencyCode ISO-4217 3-letter currency code.
185217 * @return {boolean } true if currency should be positioned before amount field.
@@ -267,6 +299,10 @@ goog.i18n.currency.adjustPrecision = function(pattern, currencyCode) {
267299 * 18: two decimals precision (2), currency sign last (16), no space (0)
268300 * 50: two decimals precision (2), currency sign last (16), space (32)
269301 *
302+ * It's not recommended to read this data directly. Format numbers using
303+ * {@link goog.i18n.NumberFormat} with
304+ * {@link goog.i18n.NumberFormat.Format.CURRENCY} instead.
305+ *
270306 * @const {!Object<!Array<?>>}
271307 */
272308goog . i18n . currency . CurrencyInfo = {
@@ -310,7 +346,7 @@ goog.i18n.currency.CurrencyInfo = {
310346 'NOK' : [ 50 , 'kr' , 'NOkr' ] ,
311347 'PAB' : [ 2 , 'B/.' , 'B/.' ] ,
312348 'PEN' : [ 2 , 'S/.' , 'S/.' ] ,
313- 'PHP' : [ 2 , '\u20B1' , 'Php ' ] ,
349+ 'PHP' : [ 2 , '\u20B1' , 'PHP ' ] ,
314350 'PKR' : [ 0 , 'Rs' , 'PKRs.' ] ,
315351 'PLN' : [ 50 , 'z\u0142' , 'z\u0142' ] ,
316352 'RON' : [ 2 , 'RON' , 'RON' ] ,
@@ -334,6 +370,11 @@ goog.i18n.currency.CurrencyInfo = {
334370
335371/**
336372 * Tier 2 currency information.
373+ *
374+ * It's not recommended to read this data directly. Format numbers using
375+ * {@link goog.i18n.NumberFormat} with
376+ * {@link goog.i18n.NumberFormat.Format.CURRENCY} instead.
377+ *
337378 * @const {!Object<!Array<?>>}
338379 */
339380goog . i18n . currency . CurrencyInfoTier2 = {
@@ -431,7 +472,7 @@ goog.i18n.currency.CurrencyInfoTier2 = {
431472 'XAF' : [ 0 , 'FCFA' , 'FCFA' ] ,
432473 'XCD' : [ 2 , '$' , 'EC$' ] ,
433474 'XOF' : [ 0 , 'CFA' , 'CFA' ] ,
434- 'XPF' : [ 0 , 'FCFP' , 'FCFP' ] ,
475+ 'XPF' : [ 48 , 'FCFP' , 'FCFP' ] ,
435476 'ZMW' : [ 0 , 'ZMW' , 'ZMW' ] ,
436477 'ZWD' : [ 0 , '$' , 'Z$' ]
437478} ;
0 commit comments