Lingui is a lightweight internationalization library with compile-time macros and a CLI. It targets React, React Native, Vue, SolidJS, Astro, Svelte, and plain Node with PO catalog extraction.
Overview
Lingui localizes JavaScript and TypeScript apps using macros that extract messages at build time. Developers wrap translatable text in components such as Trans instead of inventing message keys up front.
A CLI extracts strings into PO catalogs, translators edit them, and compiled output ships optimized runtime messages. Package lines include core APIs, React bindings with server component support, Solid and Vue integrations, and tooling plugins for Vite, SWC, and ESLint.
Rich text can embed React elements, and catalogs default to PO format while also supporting JSON and CSV. The core library is roughly 2 kB gzipped and requires Node.js 22.19 or newer for Lingui 6.
Macro plugins run through Babel or SWC during transpilation, and explicit message IDs are available when needed.
Key features
- Compile-time Trans macros for UI text
- CLI extract and compile PO catalogs
- React, Vue, Solid, and React Native packages
- Rich text with embedded components
- Vite, SWC, and ESLint tooling plugins
- Stable hashed message IDs at build time
- PO, JSON, and CSV catalog formats
Use cases
- Localize React or Vue single-page apps
- Extract translator-friendly PO files from code
- Share one i18n workflow across web and mobile