PACKAGE · INTERNATIONALIZATION

@formatjs/intl

Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.

WEEKLY DOWNLOADS 1.5M
STARS 14.7K
FORKS 1.4K
OPEN ISSUES 7
GZIP SIZE 12.9 kB
UNPACKED SIZE 89.2 kB
DEPENDENCIES 5
LAST UPDATED 4mo ago
DOWNLOAD TRENDS

@formatjs/intl downloads — last 12 months

Download trends for @formatjs/intl1 download series from Jun 2025 to May 2026. Use left and right arrow keys to inspect monthly values.03.5M7.0M10.5M14.0MJun 2025SepDecMarMay 2026
@formatjs/intl
ABOUT @FORMATJS/INTL

The @formatjs/intl package addresses the complex challenge of internationalizing JavaScript applications by providing a comprehensive API for handling locale-specific formatting of dates, numbers, and strings. It simplifies the process of adapting applications to different languages and cultural conventions, reducing the burden on developers to manually manage these variations.

Its core philosophy centers around extracting locale data and providing declarative formatting capabilities, aiming to be a robust solution for developers building globalized user experiences. The library is designed for developers who need to support multiple languages and regions efficiently and accurately within their web applications, ensuring consistency across diverse user bases.

Key features include rich formatting APIs and hooks for common internationalization tasks, such as date and number formatting using `formatDate` and `formatNumber`, alongside sophisticated message formatting that supports pluralization rules via `formatMessage`. This approach encourages writing translatable messages in a structured way, often using ICU message syntax, which is then resolved from translation lookups.

@formatjs/intl integrates smoothly into modern JavaScript development workflows, particularly within React applications, where its hooks like `useIntl` and `FormattedMessage` simplify state management and component rendering. It's also compatible with various build tools and server-side rendering setups, making it a versatile choice for different application architectures.

With a weekly download count of 3.3 million and a substantial GitHub following, @formatjs/intl is a mature and widely adopted library in the i18n ecosystem. Its unpacked size of 89.2 kB and gzipped bundle size of 12.9 kB represent a reasonable trade-off for the extensive functionality it offers to developers.

Developers should be aware that while powerful, the library requires careful management of locale data, which can increase application size if many languages are supported. Furthermore, understanding ICU message syntax is beneficial for leveraging its full capabilities, particularly for complex pluralization and gendered translations.

WHEN TO USE
  • When formatting dates, times, and numbers according to locale-specific conventions in React applications using hooks like `useIntl`.
  • When handling complex string translations that involve pluralization, gender, or other linguistic variations using `formatMessage` and ICU message syntax.
  • When building applications that need to support a wide range of languages and regions, ensuring consistent and accurate output across diverse user bases.
  • When integrating internationalization directly into the component tree with `FormattedMessage` or `FormattedNumber` components in React.
  • When leveraging `react-intl`'s capabilities for server-side rendering setups to pre-render localized content.
  • When managing locale data and translations through declarative message definitions.
WHEN NOT TO USE
  • If your application only requires simple string replacements without any locale-specific formatting or pluralization, consider a lighter key-value store.
  • If you need to internationalize non-JavaScript parts of your application, you will need complementary tools for those environments.
  • When the overhead of managing ICU message syntax and locale data is disproportionate to the i18n requirements.
  • If you are explicitly targeting environments where JavaScript execution is not feasible or desired for localization.
  • When a very basic i18n solution with minimal dependencies is sufficient and performance is the absolute primary concern over feature richness.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 3
@formatjs/intl vs i18next ★ 8.6K · 8.8M/wk @formatjs/intl vs @lingui/core ★ 5.8K · 600.3K/wk @formatjs/intl vs next-intl ★ 4.3K · 1.9M/wk