33
33
34
34
35
35
goog . provide ( 'goog.i18n.currency' ) ;
36
+ goog . provide ( 'goog.i18n.currency.CurrencyInfo' ) ;
37
+ goog . provide ( 'goog.i18n.currency.CurrencyInfoTier2' ) ;
36
38
37
39
38
40
/**
@@ -46,7 +48,7 @@ goog.i18n.currency.PRECISION_MASK_ = 0x07;
46
48
* Whether the currency sign should be positioned after the number.
47
49
* @private
48
50
*/
49
- goog . i18n . currency . POSITION_FLAG_ = 0x08 ;
51
+ goog . i18n . currency . POSITION_FLAG_ = 0x10 ;
50
52
51
53
52
54
/**
@@ -56,16 +58,27 @@ goog.i18n.currency.POSITION_FLAG_ = 0x08;
56
58
goog . i18n . currency . SPACE_FLAG_ = 0x20 ;
57
59
58
60
61
+ /**
62
+ * Whether tier2 was enabled already by calling addTier2Support().
63
+ * @private
64
+ */
65
+ goog . i18n . currency . tier2Enabled_ = false ;
66
+
67
+
59
68
/**
60
69
* This function will add tier2 currency support. Be default, only tier1
61
70
* (most popular currencies) are supported. If an application really needs
62
71
* to support some of the rarely used currencies, it should call this function
63
72
* before any other functions in this namespace.
64
73
*/
65
74
goog . i18n . currency . addTier2Support = function ( ) {
66
- for ( var key in goog . i18n . currency . CurrencyInfoTier2 ) {
67
- goog . i18n . currency . CurrencyInfo [ key ] =
68
- goog . i18n . currency . CurrencyInfoTier2 [ key ] ;
75
+ // Protection from executing this these again and again.
76
+ if ( ! goog . i18n . currency . tier2Enabled_ ) {
77
+ for ( var key in goog . i18n . currency . CurrencyInfoTier2 ) {
78
+ goog . i18n . currency . CurrencyInfo [ key ] =
79
+ goog . i18n . currency . CurrencyInfoTier2 [ key ] ;
80
+ }
81
+ goog . i18n . currency . tier2Enabled_ = true ;
69
82
}
70
83
} ;
71
84
@@ -244,60 +257,75 @@ goog.i18n.currency.adjustPrecision = function(pattern, currencyCode) {
244
257
* the currency sign should be positioned after the number. Valid values are 0
245
258
* (before the number) or 16 (after the number). The space flag indicates
246
259
* whether a space should be inserted between the currency sign and number.
247
- * Valid values are 0 (no space) and 24 (space).
260
+ * Valid values are 0 (no space) and 32 (space).
248
261
*
249
262
* The number in the array is calculated by adding together the mask and flag
250
263
* values. For example:
251
264
*
252
265
* 0: no precision (0), currency sign first (0), no space (0)
253
266
* 2: two decimals precision (2), currency sign first (0), no space (0)
254
267
* 18: two decimals precision (2), currency sign last (16), no space (0)
255
- * 42 : two decimals precision (2), currency sign last (16), space (24 )
268
+ * 50 : two decimals precision (2), currency sign last (16), space (32 )
256
269
*
257
270
* @type {!Object.<!Array> }
258
271
*/
259
272
goog . i18n . currency . CurrencyInfo = {
260
273
'AED' : [ 2 , 'dh' , '\u062f.\u0625.' , 'DH' ] ,
274
+ 'ALL' : [ 0 , 'Lek' , 'Lek' ] ,
261
275
'AUD' : [ 2 , '$' , 'AU$' ] ,
262
276
'BDT' : [ 2 , '\u09F3' , 'Tk' ] ,
277
+ 'BGN' : [ 2 , 'lev' , 'lev' ] ,
263
278
'BRL' : [ 2 , 'R$' , 'R$' ] ,
264
279
'CAD' : [ 2 , '$' , 'C$' ] ,
280
+ 'CDF' : [ 2 , 'FrCD' , 'CDF' ] ,
265
281
'CHF' : [ 2 , 'CHF' , 'CHF' ] ,
266
282
'CLP' : [ 0 , '$' , 'CL$' ] ,
267
283
'CNY' : [ 2 , '¥' , 'RMB¥' ] ,
268
284
'COP' : [ 0 , '$' , 'COL$' ] ,
269
285
'CRC' : [ 0 , '\u20a1' , 'CR\u20a1' ] ,
270
- 'CZK' : [ 2 , 'K\u010d' , 'K\u010d' ] ,
286
+ 'CZK' : [ 50 , 'K\u010d' , 'K\u010d' ] ,
271
287
'DKK' : [ 18 , 'kr' , 'kr' ] ,
272
288
'DOP' : [ 2 , '$' , 'RD$' ] ,
273
289
'EGP' : [ 2 , '£' , 'LE' ] ,
274
- 'EUR' : [ 18 , '€' , '€' ] ,
290
+ 'ETB' : [ 2 , 'Birr' , 'Birr' ] ,
291
+ 'EUR' : [ 2 , '€' , '€' ] ,
275
292
'GBP' : [ 2 , '£' , 'GB£' ] ,
276
293
'HKD' : [ 2 , '$' , 'HK$' ] ,
294
+ 'HRK' : [ 2 , 'kn' , 'kn' ] ,
295
+ 'HUF' : [ 0 , 'Ft' , 'Ft' ] ,
296
+ 'IDR' : [ 0 , 'Rp' , 'Rp' ] ,
277
297
'ILS' : [ 2 , '\u20AA' , 'IL\u20AA' ] ,
278
298
'INR' : [ 2 , '\u20B9' , 'Rs' ] ,
299
+ 'IRR' : [ 0 , 'Rial' , 'IRR' ] ,
279
300
'ISK' : [ 0 , 'kr' , 'kr' ] ,
280
301
'JMD' : [ 2 , '$' , 'JA$' ] ,
281
302
'JPY' : [ 0 , '¥' , 'JP¥' ] ,
282
303
'KRW' : [ 0 , '\u20A9' , 'KR₩' ] ,
283
304
'LKR' : [ 2 , 'Rs' , 'SLRs' ] ,
305
+ 'LTL' : [ 2 , 'Lt' , 'Lt' ] ,
306
+ 'LVL' : [ 2 , 'Ls' , 'Ls' ] ,
284
307
'MNT' : [ 0 , '\u20AE' , 'MN₮' ] ,
285
308
'MXN' : [ 2 , '$' , 'Mex$' ] ,
286
309
'MYR' : [ 2 , 'RM' , 'RM' ] ,
287
- 'NOK' : [ 18 , 'kr' , 'NOkr' ] ,
310
+ 'NOK' : [ 50 , 'kr' , 'NOkr' ] ,
288
311
'PAB' : [ 2 , 'B/.' , 'B/.' ] ,
289
312
'PEN' : [ 2 , 'S/.' , 'S/.' ] ,
290
313
'PHP' : [ 2 , '\u20B1' , 'Php' ] ,
291
314
'PKR' : [ 0 , 'Rs' , 'PKRs.' ] ,
292
- 'RUB' : [ 42 , 'руб.' , 'руб.' ] ,
315
+ 'PLN' : [ 50 , 'z\u0142' , 'z\u0142' ] ,
316
+ 'RON' : [ 2 , 'RON' , 'RON' ] ,
317
+ 'RSD' : [ 0 , 'din' , 'RSD' ] ,
318
+ 'RUB' : [ 50 , 'руб.' , 'руб.' ] ,
293
319
'SAR' : [ 2 , 'Rial' , 'Rial' ] ,
294
320
'SEK' : [ 2 , 'kr' , 'kr' ] ,
295
321
'SGD' : [ 2 , '$' , 'S$' ] ,
296
322
'THB' : [ 2 , '\u0e3f' , 'THB' ] ,
297
323
'TRY' : [ 2 , 'TL' , 'YTL' ] ,
298
324
'TWD' : [ 2 , 'NT$' , 'NT$' ] ,
325
+ 'TZS' : [ 0 , 'TSh' , 'TSh' ] ,
326
+ 'UAH' : [ 2 , '\u20B4' , 'UAH' ] ,
299
327
'USD' : [ 2 , '$' , 'US$' ] ,
300
- 'UYU' : [ 2 , '$' , 'UY$ ' ] ,
328
+ 'UYU' : [ 2 , '$' , '$U ' ] ,
301
329
'VND' : [ 0 , '\u20AB' , 'VN\u20AB' ] ,
302
330
'YER' : [ 0 , 'Rial' , 'Rial' ] ,
303
331
'ZAR' : [ 2 , 'R' , 'ZAR' ]
@@ -309,16 +337,14 @@ goog.i18n.currency.CurrencyInfo = {
309
337
* @type {!Object.<!Array> }
310
338
*/
311
339
goog . i18n . currency . CurrencyInfoTier2 = {
312
- 'AFN' : [ 16 , 'Af.' , 'AFN' ] ,
313
- 'ALL' : [ 0 , 'Lek' , 'Lek' ] ,
340
+ 'AFN' : [ 48 , 'Af.' , 'AFN' ] ,
314
341
'AMD' : [ 0 , 'Dram' , 'dram' ] ,
315
342
'AOA' : [ 2 , 'Kz' , 'Kz' ] ,
316
343
'ARS' : [ 2 , '$' , 'AR$' ] ,
317
344
'AWG' : [ 2 , 'Afl.' , 'Afl.' ] ,
318
345
'AZN' : [ 2 , 'man.' , 'man.' ] ,
319
- 'BAM' : [ 18 , 'KM' , 'KM' ] ,
346
+ 'BAM' : [ 2 , 'KM' , 'KM' ] ,
320
347
'BBD' : [ 2 , '$' , 'Bds$' ] ,
321
- 'BGN' : [ 2 , 'lev' , 'lev' ] ,
322
348
'BHD' : [ 3 , 'din' , 'din' ] ,
323
349
'BIF' : [ 0 , 'FBu' , 'FBu' ] ,
324
350
'BMD' : [ 2 , '$' , 'BD$' ] ,
@@ -329,14 +355,12 @@ goog.i18n.currency.CurrencyInfoTier2 = {
329
355
'BWP' : [ 2 , 'P' , 'pula' ] ,
330
356
'BYR' : [ 0 , 'BYR' , 'BYR' ] ,
331
357
'BZD' : [ 2 , '$' , 'BZ$' ] ,
332
- 'CDF' : [ 2 , 'FrCD' , 'CDF' ] ,
333
358
'CUC' : [ 1 , '$' , 'CUC$' ] ,
334
359
'CUP' : [ 2 , '$' , 'CU$' ] ,
335
360
'CVE' : [ 2 , 'CVE' , 'Esc' ] ,
336
361
'DJF' : [ 0 , 'Fdj' , 'Fdj' ] ,
337
362
'DZD' : [ 2 , 'din' , 'din' ] ,
338
363
'ERN' : [ 2 , 'Nfk' , 'Nfk' ] ,
339
- 'ETB' : [ 2 , 'Birr' , 'Birr' ] ,
340
364
'FJD' : [ 2 , '$' , 'FJ$' ] ,
341
365
'FKP' : [ 2 , '£' , 'FK£' ] ,
342
366
'GEL' : [ 2 , 'GEL' , 'GEL' ] ,
@@ -347,12 +371,8 @@ goog.i18n.currency.CurrencyInfoTier2 = {
347
371
'GTQ' : [ 2 , 'Q' , 'GTQ' ] ,
348
372
'GYD' : [ 0 , '$' , 'GY$' ] ,
349
373
'HNL' : [ 2 , 'L' , 'HNL' ] ,
350
- 'HRK' : [ 2 , 'kn' , 'kn' ] ,
351
374
'HTG' : [ 2 , 'HTG' , 'HTG' ] ,
352
- 'HUF' : [ 0 , 'Ft' , 'Ft' ] ,
353
- 'IDR' : [ 0 , 'Rp' , 'Rp' ] ,
354
375
'IQD' : [ 0 , 'din' , 'IQD' ] ,
355
- 'IRR' : [ 0 , 'Rial' , 'IRR' ] ,
356
376
'JOD' : [ 3 , 'din' , 'JOD' ] ,
357
377
'KES' : [ 2 , 'Ksh' , 'Ksh' ] ,
358
378
'KGS' : [ 2 , 'KGS' , 'KGS' ] ,
@@ -366,8 +386,6 @@ goog.i18n.currency.CurrencyInfoTier2 = {
366
386
'LBP' : [ 0 , 'L£' , 'LBP' ] ,
367
387
'LRD' : [ 2 , '$' , 'L$' ] ,
368
388
'LSL' : [ 2 , 'LSL' , 'LSL' ] ,
369
- 'LTL' : [ 2 , 'Lt' , 'Lt' ] ,
370
- 'LVL' : [ 2 , 'Ls' , 'Ls' ] ,
371
389
'LYD' : [ 3 , 'din' , 'LD' ] ,
372
390
'MAD' : [ 2 , 'dh' , 'MAD' ] ,
373
391
'MDL' : [ 2 , 'MDL' , 'MDL' ] ,
@@ -386,11 +404,8 @@ goog.i18n.currency.CurrencyInfoTier2 = {
386
404
'NZD' : [ 2 , '$' , 'NZ$' ] ,
387
405
'OMR' : [ 3 , 'Rial' , 'OMR' ] ,
388
406
'PGK' : [ 2 , 'PGK' , 'PGK' ] ,
389
- 'PLN' : [ 2 , 'z\u0142' , 'z\u0142' ] ,
390
407
'PYG' : [ 0 , 'Gs' , 'PYG' ] ,
391
408
'QAR' : [ 2 , 'Rial' , 'QR' ] ,
392
- 'RON' : [ 2 , 'RON' , 'RON' ] ,
393
- 'RSD' : [ 0 , 'din' , 'RSD' ] ,
394
409
'RWF' : [ 0 , 'RF' , 'RF' ] ,
395
410
'SBD' : [ 2 , '$' , 'SI$' ] ,
396
411
'SCR' : [ 2 , 'SCR' , 'SCR' ] ,
@@ -400,16 +415,13 @@ goog.i18n.currency.CurrencyInfoTier2 = {
400
415
'SOS' : [ 0 , 'SOS' , 'SOS' ] ,
401
416
'SRD' : [ 2 , '$' , 'SR$' ] ,
402
417
'STD' : [ 0 , 'Db' , 'Db' ] ,
403
- 'SYP' : [ 16 , '£' , 'SY£' ] ,
418
+ 'SYP' : [ 0 , '£' , 'SY£' ] ,
404
419
'SZL' : [ 2 , 'SZL' , 'SZL' ] ,
405
420
'TJS' : [ 2 , 'Som' , 'TJS' ] ,
406
421
'TND' : [ 3 , 'din' , 'DT' ] ,
407
422
'TOP' : [ 2 , 'T$' , 'T$' ] ,
408
423
'TTD' : [ 2 , '$' , 'TT$' ] ,
409
- 'TZS' : [ 0 , 'TSh' , 'TSh' ] ,
410
- 'UAH' : [ 2 , '\u20B4' , 'UAH' ] ,
411
424
'UGX' : [ 0 , 'UGX' , 'UGX' ] ,
412
- 'UYU' : [ 1 , '$' , '$U' ] ,
413
425
'UZS' : [ 0 , 'so\u02bcm' , 'UZS' ] ,
414
426
'VEF' : [ 2 , 'Bs' , 'Bs' ] ,
415
427
'VUV' : [ 0 , 'VUV' , 'VUV' ] ,
0 commit comments