Globalize (JavaScript library)
Globalize is a cross-platform JavaScript library for internationalization and localization that uses the Unicode Common Locale Data Repository.
Overview
Globalize provides number formatting and parsing, date and time formatting and parsing, currency formatting, unit formatting, message formatting, and plural support.Design Goals:
- Leverages the Unicode CLDR data and follows its UTS#35 specification.
- Keeps code separate from i18n content. Doesn't host or embed any locale data in the library. Empowers developers to control the loading mechanism of their choice.
- Allows developers to load as much or as little data as they need. Avoids duplicating data if using multiple i18n libraries that leverage CLDR.
- Keeps code modular. Allows developers to load the i18n functionalities they need.
- Runs in browsers and Node.js, consistently across all of them.
- Makes globalization as easy to use as jQuery.
Usage
Since Globalize doesn't bundle any localization data, it has to be first initialized using some CLDR content:var Globalize = require;
Globalize.load.entireSupplemental );
Globalize.load.entireMainFor;
Globalize.formatDate);
// > "11/27/2015"
Globalize.formatDate);
// > "27/11/2015"