Questions tagged [ecmascript-intl]

ECMAScript Internationalization API

The ECMAScript Internationalization API (ECMA-402) is a series of extensions to the ECMAScript language to add support for various locale-specific formatting of numbers and dates, as well as the comparison of different Unicode strings.

It does so by providing a new Intl global object to work with, as well as providing firmer specification and new arguments to methods which were previously implementation-defined, such as Number.prototype.toLocaleString.

40 questions
3
votes
0 answers

Is there a way in JavaScript that (10000).toLocaleString("zh") can print out 一萬 or 一万 in Chinese locale?

Perhaps in any browser or any environment such as NodeJS? The closest I can get to is: console.log((10000).toLocaleString("zh-u-nu-hanidec")) "一〇,〇〇〇" inside of Chrome or Firefox. (The result being looked for is 一萬 or 一万, with the first form…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
3
votes
2 answers

How to see what locales a given Node.js version supports and how to enable missing locales?

My Node.js version on Windows 8.1 is: $ node -v v5.3.0 But it seems it doesn't support locale identification and negotiation. I mean the support of ECMAScript Internationalization API. Only en locale is supported. Here is an example in a browser…
Green
  • 28,742
  • 61
  • 158
  • 247
3
votes
2 answers

Node: Cannot replace Intl to use IntlPolyfill

I'm trying to use Intl with pt-BR locale and I can't get that to work with Node 0.12. Code: global.Intl = require('intl/Intl'); require('intl/locale-data/jsonp/pt-BR.js'); var options = { year: 'numeric', month: 'long' }; var dateTimeFormat = new…
Alan Souza
  • 7,475
  • 10
  • 46
  • 68
3
votes
1 answer

Custom Intl.Collators?

Is it possible to create a custom Intl.Collator object for Javascript? Suppose I have: var letters = [ "a", "n", "ñ", "x" ] If I sort them, the ñ will go to the end by default: letters.sort() // [ "a", "n", "x", "ñ" ] However, using the new…
user2467065
3
votes
2 answers

Intl is not defined firefox

I have following java scripts code which runing well in chrome but fail in firefox and IE. the error message of FF is 'ReferenceError: Intl is not defined' the error message of IE is 'SCRIPT5009: 'Intl' is undefined '