/lingui:lingui-framework-setupfrom Lingui Skills
Guides through setting up Lingui internationalization in React and Vue frameworks. Detects the stack (Next.js, Vite, Remix, Nuxt, etc.) and applies the correct macro transform, locale detection, and SSR configuration.
Ships in Lingui Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Correct Lingui setup is framework-shaped: what works in a Vite SPA breaks in React Server Components, and a module-level i18n singleton that is fine in the browser bleeds locales across requests under SSR. This skill routes to a framework-native recipe instead of a generic I18nProvider answer.
Work in this order: detect the stack → apply the common steps → follow the framework reference → run the verification sequence.
Read package.json and the build config before recommending anything. Never guess the compiler — the macro transform silently does nothing when wired into the wrong one.
| Signal | Stack | Reference |
|---|---|---|
next in deps, app/ or src/app/ with layout.tsx | Next.js App Router | nextjs-app-router.md |
next in deps, pages/ with _app.tsx, no app/ | Next.js Pages Router | Supported by Lingui, brief notes in nextjs-app-router.md |
@tanstack/react-start in deps | TanStack Start (SSR) | tanstack-start.md |
@react-router/dev in devDeps + react-router.config.* | React Router 7 framework mode (SSR) | react-router-remix.md |
@remix-run/dev ≥ 2.7 in devDeps + vite | Remix v2 (Vite build, SSR) | react-router-remix.md |
vite + react, none of the above | Vite SPA (incl. declarative React Router, TanStack Router) | vite-spa.md |
vue ≥ 3.4 + @vitejs/plugin-vue | Vue 3 on Vite (incl. Vue Router) | vue-vite.md |
nuxt in deps | Nuxt (SSR) | Brief notes in vue-vite.md |
Macro transform (decides what to install). On every Vite React stack the default is the native transform in @lingui/vite-plugin 6.9.1+, whatever the React plugin; the Vite compiler rows are fallbacks, and vite-spa.md lists when they apply:
| Signal | Compiler | Macro transform |
|---|---|---|
| Any Vite React stack | none needed | lingui({ macroTransform: true }) |
| Vue (Vite, Nuxt) | Babel, via @lingui/vue | linguiVue() from @lingui/vue/vite — also compiles <template> macros. The native transform doesn't support Vue: never macroTransform: true |
@vitejs/plugin-react-swc | SWC | @lingui/swc-plugin (pin exactly — see the swc-plugin-compatibility skill) |
@vitejs/plugin-react ^5 or lower | Babel | @lingui/babel-plugin-lingui-macro via the plugin's babel option |
@vitejs/plugin-react ^6+, Vite 8 | Babel, standalone pass | v6 removed the babel option — run the macro as its own pass: @rolldown/plugin-babel + linguiTransformerBabelPreset(). Keeps the stock React plugin |
@vitejs/plugin-react ^6+, Vite ≤ 7 | Babel, standalone pass | Same, via vite-plugin-babel (no Rolldown). Switching to @vitejs/plugin-react-swc also works, at the cost of an exact pin |
Next.js, no .babelrc | SWC | @lingui/swc-plugin via experimental.swcPlugins |
Next.js with .babelrc | Babel | @lingui/babel-plugin-lingui-macro in .babelrc (a Babel config disables Next's SWC) |
One more distinction that changes everything: react-router in deps without @react-router/dev is a declarative SPA (<Routes> in JSX) — that is the Vite SPA reference, not the framework-mode one. Route-module loader/+types code written into a declarative SPA is dead on arrival.
Version gate. Lingui 6 is current: ESM-only, requires Node ≥ 22.19 (or ≥ 24). Install @lingui/core@^6 @lingui/react@^6 (Vue: @lingui/vue@^6) and dev @lingui/cli@^6. If the project cannot meet the Node requirement, pin every @lingui/* package to ^5 — do not mix majors. Do not install @lingui/macro: since v5 the macros live at @lingui/react/macro and @lingui/core/macro.
Per-stack extras (details in each reference):
| Stack | Extra runtime | Extra dev |
|---|---|---|
| Next.js App Router | — | @lingui/swc-plugin (exact pin) |
| Vite SPA | @lingui/detect-locale | @lingui/vite-plugin (also transforms macros) |
| React Router 7 / Remix | — | @lingui/vite-plugin (also transforms macros), @lingui/format-po |
| TanStack Start | — | @lingui/vite-plugin (also transforms macros) |
| Vue 3 on Vite | @lingui/detect-locale | @lingui/vite-plugin (catalogs only), @lingui/extractor-vue, @babel/core |
@lingui/detect-locale is browser-only (navigator, localStorage, window.location). Never install it on an SSR stack — it throws on the server or desyncs hydration; SSR stacks resolve locale from the request (cookie / Accept-Language) instead.
Config and catalogs. Create lingui.config.ts with sourceLocale, locales, and one catalogs entry; the lingui-best-practices skill owns catalog hygiene (build-script wiring, gitignore rules, CI drift check) and the single-sourced locale module (locales.ts with resolveLocale, getDirection, localeDisplayName) — reuse both, do not re-derive them.
Two catalog-loading models. On Vite-based stacks, @lingui/vite-plugin compiles .po on import — await import('./locales/en/messages.po') just works, there are no compiled artifacts to script or gitignore. Next.js has no Vite pipeline: run lingui compile prepended to dev/build scripts and import the compiled catalogs (@lingui/loader is webpack-only and Turbopack is the Next 15/16 default, so a loader-based setup is a trap).
Read the matching reference file fully before editing the project. Every reference follows the same section contract, in order:
packages → build-tool integration → lingui.config → locale resolution → provider/layout wiring → routing strategies → language switcher → gotchas → verification
If the project needs locale-prefixed URLs, every reference offers the same three strategies — unprefixed source locale, all locales prefixed, or no URL locale (cookie/storage only). Restructuring routes is invasive: ask the user which strategy they want before moving files.
Run in this order; each step must pass before the next:
npx lingui extract --clean # catalogs regenerate; count matches expectations
npx lingui compile # only on stacks with compiled catalogs (Next.js)
npx tsc --noEmit # types resolve, incl. catalog imports (Vue: vue-tsc --noEmit)
npm run build # macro wiring errors surface here
Then prove the transform ran. A green build does not: a mis-wired macro transform is silently a no-op and the app ships in the source language. Translate one string in a non-source catalog, run the app in that locale, and confirm the translation reaches the browser (each reference gives the stack's exact check — curl the server-rendered HTML on SSR stacks, hard-load a deep link on the SPA). The setup is done when you have seen a translated string, not when the build is green.
Raw untranslated text at that point is a compiler wiring problem — wrong plugin, bare-string SWC entry, or the @vitejs/plugin-react@6 babel trap; see the swc-plugin-compatibility skill. On the native transform, a missing macroTransform: true is not silent: the untransformed macro import throws "being executed outside the context of compilation" in the browser.
Another stack (a new meta-framework, a new build tool) costs two edits: one row in the Step 1 detection table, and one file under references/ following the Step 3 section contract. Framework-specific facts go in the reference; anything true of every stack — the version gate, the two catalog-loading models, the SSR detect-locale rule — stays here, stated once. Every non-obvious rule carries a one-sentence why.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
lingui, i18n, internationalization, framework-setup, react, vue
npx claudepluginhub lingui/skills --plugin lingui6 skills in this plugin
/enhanced-message-contextAdd translator comments to Lingui messages so translations are accurate. Use in Lingui projects when adding or modifying translatable messages, when strings are short or ambiguous ("Back", "Delete", "Post"), when placeholders are unclear ({count}, {name}), when deciding between comment and context, or when auditing extracted .po catalogs for missing translator context./find-unwrapped-stringsAudit a Lingui project for hardcoded user-facing strings that were never wrapped in macros. Use when asked to find untranslated, unwrapped, or hardcoded strings, to check i18n coverage, to audit what an i18n setup or migration missed, or when text renders in the source language after everything was supposedly translated./lingui-best-practicesImplement internationalization with Lingui in React, Vue and JavaScript applications. Use when adding i18n, translating UI, working with Trans/useLingui/Plural, extracting messages, compiling catalogs, or when the user mentions Lingui, message extraction, ICU MessageFormat, or working with .po files. Not for projects on another i18n library (i18next, react-intl, next-intl) unless they are moving to Lingui./migrate-i18next-to-linguiMigrate i18next/react-i18next projects to Lingui. Use when the user wants to replace i18next, react-i18next, useTranslation, i18n.t(), Trans i18nKey, or i18next JSON catalogs with Lingui equivalents. Covers package installation, config setup, code transformation patterns, plural migration, namespace handling, and catalog conversion./swc-plugin-compatibilityDiagnose and fix Lingui SWC plugin compatibility errors with Next.js, Vite, Rspack, or other SWC runtimes. Use when seeing errors like "failed to invoke plugin", "failed to run Wasm plugin transform", "Failed to deserialize program received from host", "Failed to execute SWC plugin", "out of bounds memory access", or "LayoutError" during builds with @lingui/swc-plugin — or when macros are silently not transformed (build succeeds but Trans/t render as raw untranslated output).Other plugins' skills for the same job