我在 Windows 8.1 上的 Node.js 版本是:
$ node -v
v5.3.0
但它似乎不支持语言环境识别和协商。我的意思是ECMAScript Internationalization API的支持。仅en
支持语言环境。这是浏览器和 Node.js 中的示例。在浏览器中,可以很好地识别语言环境:
// en
> Intl.NumberFormat('en', {currency: 'USD', style:"currency"}).format(300)
> "$300.00"
// ru
> Intl.NumberFormat('ru', {currency: 'USD', style:"currency"}).format(300)
> "300,00 $"
但是在 Node.js 中它不起作用。Node.js 对和都返回相同的en
格式:en
ru
// en
> Intl.NumberFormat('en', {currency: 'USD', style:"currency"}).format(300)
'$300.00'
// ru
> Intl.NumberFormat('ru', {currency: 'USD', style:"currency"}).format(300)
'$300.00'
有没有办法查看给定的 Node.js 支持哪些语言环境以及如何启用所需的语言环境?