Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an i18n (Intl) shim for JavaScript?

I am looking for a shim for the ECMAScript Internationalization API. Does anyone know of such a project? (Even if it's still currently a work-in-progress.)

like image 328
Nathan Wall Avatar asked Feb 07 '13 16:02

Nathan Wall


People also ask

What is Intl Javascript?

The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting.

What are locales in Javascript?

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.


1 Answers

Yes, there's a polyfill for ECMA-402 (aka ECMA Internationalization API Specification) available at https://github.com/andyearnshaw/Intl.js.

For use in Node.js applications, you can install with NPM:

npm install intl

It's also available as a Bower component for the front-end:

bower install intl

There's support for NumberFormat and DateTimeFormat, but no support for Collator. Currently, for client-side browser environments, you need to add the locale data using a separate function. See the README.md file for details.

Disclaimer: @AndyE is the author of Intl.js.

like image 134
Andy E Avatar answered Sep 21 '22 10:09

Andy E