formatjs README

The project's README from github.com/formatjs/formatjs. As one markdown file: README.md.

FormatJS

Unit Tests Slack FormatJS Sauce Browser Matrix Status

This repository is the home of FormatJS and related libraries.

Slack: Join us on Slack at formatjs.slack.com for help, general conversation and more 💬🎊🎉 You can sign-up using this invitation link.

Development

See CONTRIBUTING.md for instructions.

Published Packages

Choose by application ecosystem. Registry names identify how to install a package; implementation language can differ. For example, @formatjs/cli is Rust-backed and distributed through npm.

Ecosystem Distribution Entry point
JavaScript / TypeScript npm React, Vue, Svelte, message formatting, Intl polyfills, build tools
Rust crates.io Message runtime, parsers, Intl cores
Python PyPI Rust-backed message runtime and parser bindings
Hermes / React Native GitHub Releases Native SDK with Rust libraries and C++/JSI installers

Intl APIs: npm and Rust

npm packages expose JavaScript APIs with TypeScript types. Rust crates expose native operations for Rust applications and host integrations. LocaleMatcher is a proposal ponyfill; the other rows implement standardized Intl APIs.

API JavaScript / TypeScript (npm) Rust (crates.io)
Collator @formatjs/intl-collator formatjs_intl_collator
DateTimeFormat @formatjs/intl-datetimeformat formatjs_intl_datetimeformat
DisplayNames @formatjs/intl-displaynames formatjs_intl_displaynames
DurationFormat @formatjs/intl-durationformat formatjs_intl_durationformat
getCanonicalLocales @formatjs/intl-getcanonicallocales formatjs_intl_getcanonicallocales
ListFormat @formatjs/intl-listformat formatjs_intl_listformat
Locale @formatjs/intl-locale formatjs_intl_locale
LocaleMatcher @formatjs/intl-localematcher formatjs_intl_localematcher
NumberFormat @formatjs/intl-numberformat formatjs_intl_numberformat
PluralRules @formatjs/intl-pluralrules formatjs_intl_pluralrules
RelativeTimeFormat @formatjs/intl-relativetimeformat formatjs_intl_relativetimeformat
Segmenter @formatjs/intl-segmenter formatjs_intl_segmenter
supportedValuesOf @formatjs/intl-supportedvaluesof formatjs_intl_supportedvaluesof

DateTimeFormat calendar add-ons are npm packages named @formatjs/intl-datetimeformat-calendar-*; see calendar installation. Rust calendar support is in formatjs_intl_datetimeformat_calendars.

JavaScript / TypeScript libraries and tools (npm)

Purpose Packages
Application APIs react-intl, vue-intl, @formatjs/svelte-intl, @formatjs/intl
ICU MessageFormat intl-messageformat, @formatjs/icu-messageformat-parser, @formatjs/icu-skeleton-parser
CLI @formatjs/cli, @formatjs/cli-lib
Build transforms babel-plugin-formatjs, @formatjs/ts-transformer, @formatjs/unplugin
Linting and editing eslint-plugin-formatjs, @formatjs/editor
Utilities @formatjs/bigdecimal, @formatjs/fast-memoize, @formatjs/utils, @formatjs/ecma376

@formatjs/cli selects its @formatjs/cli-native-* platform package automatically. Package versions and licenses are listed on npm; changelogs live under packages/.

Rust libraries (crates.io)

Purpose Crates
Application message runtime formatjs_intl, formatjs_intl_macros
ICU MessageFormat runtime formatjs_icu_messageformat
ICU parsers formatjs_icu_messageformat_parser, formatjs_icu_skeleton_parser
Platform printf parsers formatjs_apple_printf_parser, formatjs_java_printf_parser
Locale-data infrastructure formatjs_intl_data, formatjs_intl_data_build
Hermes native archive formatjs_intl_hermes

See Rust Intl crates for locale-data features and the application runtime for message catalogs. Standalone CLI binaries are also available in CLI releases.

Python bindings (PyPI)

Install package Python import Purpose
py_intl intl Application message runtime and catalogs
icu_messageformat icu_messageformat ICU MessageFormat runtime
icu_messageformat_parser icu_messageformat_parser ICU message parser
icu_skeleton_parser icu_skeleton_parser Number/date skeleton parser

Install with python -m pip install <package>. These wheels bind the Rust implementations; see the Python package READMEs.

Native Hermes SDK (GitHub Releases)

SDK releases ship prebuilt Rust libraries, public headers, C++/JSI adapters, JS installers, and checksums for Android, iOS/simulator, macOS, and Linux. Integrate the SDK into your native app, then install standard Intl APIs into its Hermes runtime. See installation and supported targets.

Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs

formatjs (formatjs/formatjs)

Searching Database…

What is this?FormatJS is a monorepo of JavaScript internationalization (i18n) libraries — message formatting, date/time/number formatting, and pluralization — with react-intl as its most popular package for React apps.
Is this one library or a collection of packages?It's a monorepo publishing around 20 separate npm packages (react-intl, intl-messageformat, @formatjs/intl-numberformat, cli tools, babel/eslint plugins, etc.) that you pick and install individually based on what you need.
How do I add FormatJS to my project?Install the specific package for your use case via npm or yarn — react-intl for React apps, intl-messageformat for framework-agnostic message formatting, or one of the @formatjs/intl-* polyfills for specific Intl APIs.
Do I need React to use any of this?No — react-intl is just the React binding; core packages like intl-messageformat and the @formatjs/intl-* polyfills work standalone in any JavaScript environment, browser or Node.
What is ICU MessageFormat and why does it matter here?It's the syntax formatjs uses for translatable strings with placeholders, plurals, and gender/select cases (via intl-messageformat and icu-messageformat-parser), letting translators write one message string that adapts to any locale's grammar rules.
Why are there so many separate packages instead of one library?Each Intl capability (DateTimeFormat, NumberFormat, PluralRules, ListFormat, Segmenter, etc.) ships as its own @formatjs/intl-* polyfill package so apps only pull in the formatting features and locale data they actually need.
Does it come with build tooling for translations?Yes — @formatjs/cli extracts and compiles translation messages, and there are babel-plugin-formatjs and eslint-plugin-formatjs for extracting ids at build time and linting message usage.
Why use react-intl instead of the native Intl API directly?react-intl and the @formatjs/intl-* packages polyfill and normalize behavior across browsers/Node versions where native Intl support is inconsistent or missing, while adding React components/hooks for formatting in JSX.
Creator
formatjs
Size
109.1 MB
Stars
14.8K
Age
12y
Commits · 90 Days