Tag: ecmascript intl

String.toLocaleUpperCase():在Node.js上设置语言环境

JavaScript String toLocaleUpperCase()方法应该考虑在不同语言环境(如土耳其语)上的大小写映射(我不是映射器,而是点到土耳其语的点)。 但是,似乎该语言环境仅从操作系统中捕获:我没有看到设置语言环境的方法。 因此,如果我使用的是en-US操作系统,并且希望在“tr”中使用toLocaleUpperCase()土耳其string,则它将返回en-US版本(无dotless,I,not dotted©)。 假设我正在使用INTL( https://github.com/nodejs/node/wiki/Intl )编译的Node.js,我怎样才能定义语言环境toLocaleUpperCase() ?

节点:无法replaceIntl以使用IntlPolyfill

我正在尝试使用Intl与pt-BR语言环境,并且我无法使用Node 0.12。 码: global.Intl = require('intl/Intl'); require('intl/locale-data/jsonp/pt-BR.js'); var options = { year: 'numeric', month: 'long' }; var dateTimeFormat = new Intl.DateTimeFormat('pt-BR', options); console.log(dateTimeFormat.format(new Date())); 这个代码输出: May, 2015 我希望是:“2015年的Maio”。 然后,如果我决定创build一个新的variables,一切工作: 工作代码: global.NewIntl = require('intl/Intl'); require('intl/locale-data/jsonp/pt-BR.js'); var options = { year: 'numeric', month: 'long' }; var dateTimeFormat = new NewIntl.DateTimeFormat('pt-BR', options); console.log(dateTimeFormat.format(new Date())); 这打印出期望值。 问题 :为什么Intl全局variables不被replace?

ECMAScript国际化API与节点

有没有办法与nodejs一起使用ECMAScript国际化API ? 现在,我只需要时区支持: new Date().toLocaleString("en-US", {timeZone: "America/New_York"}) 这对于Chrome来说效果很好,但是不能和节点一起使用。 有没有像–harmony这样的选项来激活它?