lingui /js-lingui
🌍 📖 A readable, automated, and optimized (2 kb) internationalization for JavaScript
★ 5,937⑂ 478👁 30⑃ 1,425● 1,178▤ 158
+0
Daily
5,937
stars
478
forks
30
watchers
1,425
prs
1,178
issues
158
releases
README
Linguijs
Lingui is a lightweight, open-source internationalization (i18n) library for JavaScript and TypeScript. It brings compile-time macros and a CLI for message extraction to React, React Native, Vue, SolidJS, Astro, Svelte, and Node.js.
About 2 kB gzipped core · 6M+ npm downloads a month · MIT licensed
![Main Suite][Badge-MainSuite-GithubCI]
![Release Workflow Testing][Badge-ReleaseWorkflowTesting-GithubCI]
[![Code Coverage][Badge-Coverage]][Coverage]
[![PRs Welcome][Badge-PRWelcome]][PRWelcome]
[![Join the community on Discord][Badge-Discord]][Discord]
[Documentation][Documentation] · Quick Start · Why Lingui · Support · Contribute · License
Quick Start
bash
npm install @lingui/core @lingui/react
npm install --save-dev @lingui/cli
Lingui macros run at build time, so add the macro plugin for your transpiler and create a lingui.config.js. The installation guide covers both in a few minutes.
Then wrap the text you want to translate in the Trans macro. There are no message IDs to invent and no separate JSON file to keep in sync:
jsx
import { i18n } from "@lingui/core"
import { I18nProvider } from "@lingui/react"
import { Trans } from "@lingui/react/macro"
import { messages } from "./locales/en/messages"
i18n.load("en", messages)
i18n.activate("en")
export function App() {
return (
Read the documentation for more info.
)
}
Extract the messages into PO catalogs, translate them, then compile the catalogs into optimized runtime output:
bash
npx lingui extract
npx lingui compile
After translation, the Czech catalog in src/locales/cs/messages.po looks like this. The tag stands for the element, so translators never touch your markup:
po
: src/App.jsx:12
msgid "Read the documentation for more info."
msgstr "Přečtěte si dokumentaci pro více informací."
Continue with the React tutorial, or jump to React Server Components, React Native, SolidJS, Vue, or plain JavaScript. Working projects for Vite, Next.js, Remix, TanStack Start, React Native and more live in the examples directory.
Why Lingui
In key-based i18n libraries you invent a key, put the text in a JSON file, and reference the key from the code. With Lingui, the text stays where it is read:
jsx
// Key-based i18n: the code holds a key, the text lives somewhere else
{t("dashboard.welcome.title")}
// Lingui: the text is the source of truth, the catalog is generated from it
Welcome back, {name}
The code reads like the UI it renders, and reviewers see the actual copy in the diff. Nobody has to name keys or look up what a key means. Running lingui extract regenerates the catalog from the source, so new messages are added and removed ones are marked obsolete without any manual bookkeeping. Translators get the real sentence with named placeholders, plus any comments and context you add. Message IDs are stable hashes generated at build time, and explicit IDs are available when you need them.
On top of that:
- Rich text without workaTop issues
#1797`lingui extract-experimental` bugs61 comments · 2023-10-30#1393Examples upgrade24 comments · 2023-02-02#2279Custom formatters for numbers, dates etc.19 comments · 2025-07-05#1640Astro integration19 comments · 2023-05-06#2343Compatible with React Compiler?13 comments · 2025-10-14#2024Generate PO files only for components that contain some localized code9 comments · 2024-09-02#1704`compileNamespace` should take package.json "type" into account 8 comments · 2023-06-16#2391Better handling of "key" based messages in po files7 comments · 2026-01-08
Discussions
#2725Non global core macros for react apps3 comments · 2026-10-16#2720New pure native JS translation feature in Lingui - how to name it right?1 comments · 2026-10-14#2709v7 Roadmap3 comments · 2026-10-06#2697Managing translations across multiple Lingui locales1 comments · 2026-10-02#2672RFC: Vite Plugin for Automatic Per-Chunk Catalog Splitting2 comments · 2026-09-17#2657React macros are broken when using the OXC-based React Compiler1 comments · 2026-09-01#2646RFC: Default value for unsupplied message variables.3 comments · 2026-08-13#2617Decrease the frontend messages bundle size by excluding server-side-rendered messages0 comments · 2026-07-14
Latest release
v6.12.0 v6.12.0 2026-11-036.12.0 (2026-11-03) Features core: support custom ICU formatters (2721) (fb41433) (Announcement) Bug Fixes cli: don't crash orderBy "origin" on messages without origin (2760) (842f361) vite-plugin: support @rolldown/plugin-babel 0.3 (2761) (cbf16e9)