Skip to content

chore: migrate Lingui v5 to v6#200

Merged
sasagar merged 1 commit into
devfrom
chore/update-lingui-v6
May 13, 2026
Merged

chore: migrate Lingui v5 to v6#200
sasagar merged 1 commit into
devfrom
chore/update-lingui-v6

Conversation

@sasagar
Copy link
Copy Markdown
Collaborator

@sasagar sasagar commented May 13, 2026

Summary / 概要

Migrate @lingui/* from 5.9.5 to 6.0.1 following the official v6 migration guide.

Type of Change / 変更の種類

  • Breaking change / 破壊的変更 (build-time only — runtime API unchanged)
  • CI/CD / ビルド・デプロイ

Changes / 変更内容

Package updates

Package From To
@lingui/core ^5.9.5 ^6.0.1
@lingui/react ^5.9.5 ^6.0.1
@lingui/message-utils ^5.9.5 ^6.0.1
@lingui/cli ^5.9.5 ^6.0.1
@lingui/vite-plugin ^5.9.5 ^6.0.1
@lingui/babel-plugin-lingui-macro ^5.9.5 ^6.0.1
@lingui/format-po ^6.0.1 (new, required by formatter API)
@lingui/macro ^5.9.5 removed (unmaintained in v6)
babel-plugin-macros ^3.1.0 removed (no longer needed — repo uses @lingui/babel-plugin-lingui-macro directly)

Code changes

  • lingui.config.tsformat: "po"format: formatter() using @lingui/format-po.
  • src/components/ui/SearchField.tsx — sole remaining @lingui/macro import switched to @lingui/core/macro (for t) + @lingui/react/macro (for Trans), matching the rest of the codebase.
  • waku.config.tsssr.noExternal and optimizeDeps.include lists no longer reference removed @lingui/macro / babel-plugin-macros.
  • Catalogs regenerated via lingui extract && lingui compile:
    • .po files: only source-line-number drift + a handful of new strings already missing in ja (25 untranslated).
    • .ts compiled catalogs: message IDs migrated to URL-safe Base64 (+-, /_, no =) per v6 spec.

Test Plan / テスト計画

  • bun run typecheck passes (backend + frontend)
  • bun run lint passes (0 warnings, 0 errors)
  • bun run test:unit passes (1012 tests)
  • bun run build:frontend succeeds (lingui compile + waku build + SSG)
  • bun run build:backend succeeds
  • Manual smoke test of search field i18n in dev server (recommended before merge)

Notes for reviewers

  • Node.js ≥ 22.19 / Vite ≥ 6.3 are v6 requirements — both already satisfied (project pins Node 22.22, Vite 8).
  • React 19 is supported (no peer-dep change).
  • Catalog ID format change is intentional — old translations are preserved because lookups go through .po (msgid is the source string) and the compiled .ts is rebuilt deterministically.

Summary by CodeRabbit

リリースノート

  • 保守・改善
    • Lingui多言語対応ライブラリをバージョン5.9.5から6.0.1にアップグレードしました
    • フロントエンドのビルド設定と依存関係構成を最適化しました
    • パッケージ管理とモジュール解決のパフォーマンスを改善しました

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0ec1d225-3859-4523-a4f3-341b8e68b3af

📥 Commits

Reviewing files that changed from the base of the PR and between a5e326e and 92d0930.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • packages/frontend/lingui.config.ts
  • packages/frontend/package.json
  • packages/frontend/src/components/ui/SearchField.tsx
  • packages/frontend/src/locales/en/messages.po
  • packages/frontend/src/locales/en/messages.ts
  • packages/frontend/src/locales/ja/messages.po
  • packages/frontend/src/locales/ja/messages.ts
  • packages/frontend/waku.config.ts

📝 Walkthrough

概要

Lingui 依存関係を v5.9.5 から v6.0.1 にアップグレードし、フォーマッター設定、ビルド設定、マクロインポートパターンを新バージョンに対応させた。

変更内容

Lingui v6.0.1 アップグレード

レイヤー / ファイル 概要
依存関係アップグレード
packages/frontend/package.json
@lingui/core@lingui/format-po@lingui/message-utils@lingui/react をランタイム依存関係として v5.9.5 から v6.0.1 に更新。@lingui/babel-plugin-lingui-macro@lingui/cli@lingui/vite-plugin を開発依存関係として v6.0.1 に更新。
設定ファイルの v6 対応
packages/frontend/lingui.config.ts, packages/frontend/waku.config.ts
lingui.config.ts でハードコードされた "po" 形式を @lingui/format-poformatter() 関数に変更。waku.config.ts で ssr.noExternaloptimizeDeps.include@lingui/react@lingui/core のみに限定し、@lingui/macrobabel-plugin-macros を削除。
マクロインポートパターン更新
packages/frontend/src/components/ui/SearchField.tsx
@lingui/macro からの単一インポートを分割し、t@lingui/core/macroTrans@lingui/react/macro から個別にインポートするよう変更。

推定レビュー工数

🎯 2 (Simple) | ⏱️ ~10 分

兎の詩

バージョン六へと跳ねて進む、
🐰 依存の束をきれいに分けて、
設定も輸入も新しい形、
Lingui の更新、スムーズに着地。

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/update-lingui-v6

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sasagar sasagar mentioned this pull request May 13, 2026
6 tasks
- Bump @lingui/{core,react,message-utils,cli,vite-plugin,babel-plugin-lingui-macro} to ^6.0.1
- Add @lingui/format-po (required by v6 config formatter API)
- Remove deprecated @lingui/macro and babel-plugin-macros (project already
  uses @lingui/babel-plugin-lingui-macro directly via vite-plugins.ts)
- Update lingui.config.ts to use formatter() instead of string "po"
- Update SearchField.tsx imports to @lingui/core/macro + @lingui/react/macro
- Update waku.config.ts ssr.noExternal / optimizeDeps.include to drop
  removed @lingui/macro / babel-plugin-macros references
- Regenerate message catalogs (URL-safe Base64 IDs per v6 spec)

Verified: typecheck, lint, unit tests (1012), frontend & backend build.
@sasagar sasagar force-pushed the chore/update-lingui-v6 branch from f5f1ecf to 92d0930 Compare May 13, 2026 23:07
@sasagar sasagar merged commit e5acc0f into dev May 13, 2026
8 of 9 checks passed
@sasagar sasagar deleted the chore/update-lingui-v6 branch May 13, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant