boatcoder boatcoder - 2 months ago 25
Node.js Question

Where does Intl.NumberFormat support come from in node.js?

In my browser console:

> Intl.NumberFormat.supportedLocalesOf('it')
["it"]


In node on my computer:

> Intl.NumberFormat.supportedLocalesOf('it')
[]


In node on my coworkers computer:

> Intl.NumberFormat.supportedLocalesOf('it')
["it"]


Same versions of node 4.5.0

Where is the Intl.NumberFormat support supposed to come from? What do you have to build to get it included in your version of node?

Answer

By default, node builds in only a reduced set of ICU data (English only) due to file size.

If you're already building node manually, if you ./configure --with-intl=full-icu you will get the full ICU data set built-in. You can also use --with-intl=system-icu to have node use the OS ICU data.

If you're installing from some other (non-nodejs.org) source, such as an OS distribution repository, you will need to contact the maintainer of such binaries about providing builds with full-icu/system-icu.

One last option is to install the full-icu module, which will make the full-icu data set available.

Comments