主题: i18n
-
适应语言区域的界面:Intl 复数规则、日期与从右向左布局
使用浏览器的 Intl 对象格式化数字、日期和相对时间,而不是手工操作字符串;按 Intl.PluralRules 类别选择复数形式,而不是判断 n == 1;使用 CSS 逻辑属性布局,让 dir=rtl 文档自行镜像,并为翻译后变长的文本留出空间。
-
Country and currency codes in data: ISO 3166-1 and ISO 4217 without the surprises
Store countries as ISO 3166-1 alpha-2 codes and currencies as ISO 4217 alpha-3 codes with their minor-unit exponent, keep the code tables versioned because entries change, and never derive one from the other: a country has no single language or currency, and codes such as UK or XXX are traps.
机器可读: JSON