Globalize (JavaScript library)

Globalize is a cross-platform JavaScript library for internationalization and localization that uses the Unicode Common Locale Data Repository (CLDR).

Globalize
Original author(s)Rafael Xavier de Souza
Developer(s)jQuery Foundation
Initial releaseApril 23, 2015 (2015-04-23)
Stable release
1.4.2 (March 7, 2019 (2019-03-07))
Repository
Written inJavaScript
PlatformSee Browser support
TypeJavaScript library
LicenseMIT License[1]
Websitegithub.com/globalizejs/globalize

Overview

Globalize provides number formatting and parsing, date and time formatting and parsing, currency formatting, unit formatting, message formatting (ICU message format pattern), 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.

Globalize is based on the Unicode Consortium's Common Locale Data Repository (CLDR), the largest and most extensive standard repository of locale data available. CLDR is constantly updated and is used by many large applications and operating systems, to always have access to the most accurate and up-to-date locale data.

Usage

Since Globalize doesn't bundle any localization data, it has to be first initialized using some CLDR content:

var Globalize = require( "globalize" );
Globalize.load( require( "cldr-data" ).entireSupplemental() );
Globalize.load( require( "cldr-data" ).entireMainFor( "en", "es" ) );

Globalize("en").formatDate(new Date());
// > "11/27/2015"

Globalize("es").formatDate(new Date());
// > "27/11/2015"

History

Globalize was first announced in October 2010 by John Resig[2] and originally developed by David Reed, sponsored by Microsoft, under the name jQuery Globalization plugin,[3] built on top of an export of the .net locale database.[4] From there the dependency on jQuery was removed[5] and the project renamed to Globalize.[6] In a much larger effort, the project was entirely rewritten on top of Unicode's CLDR, making use of its comprehensive and accurate coverage of all kinds of localization data.[7]

gollark: When the fusion reactor hits 8MK it no longer needs power to heat but does need electromagnets.
gollark: You need to provide 19.2kRF/t constantly to run the electromagnets, however much it costs to make the fuel, and as much extra power as possible to heat it up.
gollark: As I said, with some batteries you can run it on less.
gollark: I mean, you can run it on less if you have loads of storage while the fusion reactor starts up.
gollark: 19.2kRF/t for electromagnets on a size 1, the other 10 is just to heat it up.

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.