Skip to content

Latest commit

 

History

History
134 lines (126 loc) · 2.37 KB

i18n.md

File metadata and controls

134 lines (126 loc) · 2.37 KB

goog.getMsg

/** @desc Test */
var MSG_TEST = goog.getMsg('Test');
/**
 * @meaning Meaning
 * @desc Test
 */
var MSG_TEST_MEANING = goog.getMsg('Test meaning');
/** @desc Test with placeholder */
var MSG_TEST_PLACEHOLDER = goog.getMsg('Test with {$ph}', {
	ph: 'placeholder'
});

goog.LOCALE

af, af_ZA
am, am_ET
ar, ar_001, ar_EG
bg, bg_BG
bn, bn_BD
ca, ca_AD, ca_ES
cs, cs_CZ
da, da_DK
de, de_AT, de_BE, de_CH, de_DE, de_LU
el, el_GR
en, en_AS, en_AU, en_Dsrt_US, en_FM, en_GB, en_GU, en_IE, en_IN, ...
es, es_419, es_EA, es_ES, es_IC
et, et_EE
eu, eu_ES
fa, fa_IR
fi, fi_FI
fil, fil_PH
fr, fr_BL, fr_CA, fr_FR, fr_GF, fr_GP, fr_MC, fr_MF, fr_MQ, fr_RE, fr_YT
gl, gl_ES
gsw, gsw_CH
gu, gu_IN
he, he_IL
hi, hi_IN
hr, hr_HR
hu, hu_HU
id, id_ID
in
is, is_IS
it, it_IT, it_SM
iw
ja, ja_JP
kn, kn_IN
ko, ko_KR
ln, ln_CD
lt, lt_LT
lv, lv_LV
ml, ml_IN
mr, mr_IN
ms, ms_MY
mt, mt_MT
nl, nl_CW, nl_NL, nl_SX
no
or, or_IN
pl, pl_PL
pt, pt_BR, pt_PT
ro, ro_RO
ru, ru_RU
sk, sk_SK
sl, sl_SI
sq, sq_AL
sr, sr_Cyrl_RS, sr_Latn_RS
sv, sv_SE
sw, sw_TZ
ta, ta_IN
te, te_IN
th, th_TH
tl
tr, tr_TR
uk, uk_UA
ur, ur_PK
vi, vi_VN
zh, zh_CN, zh_HK, zh_Hans_CN, zh_TW
zu, zu_ZA

development

goog.LOCALE = 'cs';
goog.require(/** goog.i18n. */);

production

closurebuilder.py \
	...
	--output_mode=compiled \
	--compiler_flags="--define=goog.LOCALE='cs'" \
	...

goog.i18n.DateTimeFormat

var fmt = new goog.i18n.DateTimeFormat(
	goog.i18n.DateTimeFormat.Format.FULL_DATETIME
);
var formattedDateTime = fmt.format(new Date());
// CS pondělí, 25. března 2013 16:38:36 UTC+1
// EN Monday, March 25, 2013 4:38:36 PM UTC+1

goog.i18n.MessageFormat

var fmt = new goog.i18n.MessageFormat(
	'There {EXAMPLE, select, ' +
		'0 {is no example} ' +
		'1 {is one example} ' +
		'other {are many examples}} '+
	'in messageformat_test.html'
);
var msg = fmt.format({'EXAMPLE': 0}); // There is no example in messageformat_test.html
var msg = fmt.format({'EXAMPLE': 1}); // There is one example in messageformat_test.html
var msg = fmt.format({'EXAMPLE': 2}); // There are many examples in messageformat_test.html

goog.i18n.NumberFormat

var fmt = new goog.i18n.NumberFormat(goog.i18n.NumberFormat.Format.CURRENCY);
var currency = fmt.format(9999.99);
// CS currency 9 999,99 Kč
// EN currency $9,999.99