gitmyhub

js-lingui

TypeScript ★ 5.8k updated 20h ago

🌍 📖 A readable, automated, and optimized (2 kb) internationalization for JavaScript

A JavaScript library for adding multi-language support to React and JavaScript apps, with a CLI for extracting and compiling translation strings and ICU MessageFormat compatibility.

TypeScriptJavaScriptReactReact NativeViteESLintsetup: moderatecomplexity 3/5

Lingui is a JavaScript library for making applications available in multiple languages, a process often called internationalization (or i18n for short). It is designed to keep the translation-related code readable rather than cluttered, while handling the formatting rules that vary across languages, such as plural forms, date formats, and gendered nouns.

The library uses a widely adopted message format standard called ICU MessageFormat under the hood. This means translation files produced by Lingui are compatible with many professional translation tools. Messages are stored in PO files by default, though CSV, JSON, and custom formats are also supported.

For React projects, Lingui provides components that let you write translatable text directly inside JSX, the syntax React developers use for markup. Links, bold text, and other markup can be included inside translated strings without pulling them apart into awkward fragments. A command-line tool extracts all the text that needs translating from your source code, compiles the resulting translation files, and validates them. Plugins for Vite and ESLint are also provided.

The library works outside React too: a core package handles the internationalization logic for any JavaScript environment, and the React Native workflow follows the same extract-and-compile process. Community-supported packages extend it to Astro and Svelte.

The total size added to a JavaScript bundle is small, around 2 kilobytes for the core. Version 6 of the library was released in April 2026. The project is open source under the MIT license and has an active community on Discord. Documentation is at lingui.dev.

Where it fits