back to home

globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data

4,835 stars
589 forks
150 issues
JavaScriptShellHTML

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing globalizejs/globalize in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/globalizejs/globalize)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Globalize A JavaScript library for internationalization and localization that leverage the official Unicode CLDR JSON data. The library works both for the browser and as a Node.js module. • About Globalize • Why globalization? • Why Globalize? • Migrating from Globalize 0.x • Where to use it? • Where does the data come from? • Only load and use what you need • Browser support • Getting started • Requirements • Installation • Usage • Performance • Compilation and the Runtime modules • Examples • Community • API • Core • Date module • Message module • Number module • Currency module • Plural module • Relative time module • Unit module • more to come... • Error reference • Contributing • Roadmap • Development • File structure • Source files • Tests • Build About Globalize Why globalization? Each language, and the countries that speak that language, have different expectations when it comes to how numbers (including currency and percentages) and dates should appear. Obviously, each language has different names for the days of the week and the months of the year. But they also have different expectations for the structure of dates, such as what order the day, month and year are in. In number formatting, not only does the character used to delineate number groupings and the decimal portion differ, but the placement of those characters differ as well. A user using an application should be able to read and write dates and numbers in the format they are accustomed to. This library makes this possible, providing an API to convert user-entered number and date strings - in their own format - into actual numbers and dates, and conversely, to format numbers and dates into that string format. Even if the application deals only with the English locale, it may still need globalization to format programming language bytes into human-understandable language and vice-versa in an effective and reasonable way. For example, to display something better than "Edited 1 minutes ago". Why Globalize? Globalize provides number formatting and parsing, date and time formatting and parsing, currency 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, so you'll always have access to the most accurate and up-to-date locale data. Globalize needs CLDR content to function properly, although it doesn't embed, hard-code, or host such content. Instead, Globalize empowers developers to load CLDR data the way they want. Vanilla CLDR in its official JSON format (no pre-processing) is expected to be provided. As a consequence, (a) Globalize avoids bugs caused by outdated i18n content. Developers can use up-to-date CLDR data directly from Unicode as soon as it's released, without having to wait for any pipeline on our side. (b) Developers have full control over which locale coverage they want to provide on their applications. (c) Developers are able to share the same i18n dataset between Globalize and other libraries that leverage CLDR. There's no need for duplicating data. Globalize is systematically tested against desktop and mobile browsers and Node.js. So, using it you'll get consistent results across different browsers and across browsers and the server. Globalize doesn't use native Ecma-402 yet, which could potentially improve date and number formatting performance. Although Ecma-402 support is improving among modern browsers and even Node.js, the functionality and locale coverage level varies between different environments (see Comparing JavaScript Libraries [slide 25][]). Globalize needs to do more research and testings to use it reliably. For alternative libraries and more, check out this [JavaScript globalization overview][]. [slide 25]: http://jsi18n.com/jsi18n.pdf [JavaScript globalization overview]: http://rxaviers.github.io/javascript-globalization/ Migrating from Globalize 0.x Are you coming from Globalize 0.x? Read our [migration guide][] to learn what have changed and how to migrate older 0.x code to up-to-date 1.x. [migration guide]: doc/migrating-from-0.x.md Where to use it? Globalize is designed to work both in the browser, or in Node.js. It supports both AMD and CommonJS. Where does the data come from? Globalize uses the Unicode CLDR, the largest and most extensive standard repository of locale data. We do NOT embed any i18n data within our library. However, we make it really easy to use. Read How to get and load CLDR JSON data for more information on its usage. Pick the modules you need | File | Minified + gzipped size | Runtime minified + gzipped size | Summary | | -------------------------- | ----------------------: | ------------------------------: | ------------------------------------------------------------ | | globalize.js | 1.7KB | 1.1KB | Core library | | globalize/currency.js | 3.0KB | 0.7KB | Currency module provides currency formatting | | globalize/date.js | 7.7KB | 4.3KB | Date module provides date formatting and parsing | | globalize/message.js | 5.3KB | 0.7KB | Message module provides ICU message format support | | globalize/number.js | 4.4KB | 2.6KB | Number module provides number formatting and parsing | | global…