作成:2026-06-13最終更新:2026-06-13
このドキュメントをあなたの好きなAIアシスタントに参照してくださいChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
このページとあなたの好きなAIアシスタントを使ってドキュメントを要約します
バージョン履歴
- "Init history"v9.0.02026/6/13
このページのコンテンツはAIを使用して翻訳されました。
英語の元のコンテンツの最新バージョンを見るEdit this doc
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy
Copy doc Markdown to clipboard
next-i18nextからIntlayerへの移行
完全で詳細なステップバイステップのチュートリアルについては、next-i18next移行ガイドをご参照ください。
Intlayerは、Next.js Pages RouterとApp Routerのすべての実装を透過的に処理します。アダプターを使用することで、next-i18nextの実装をコードの書き換えなしで移行できます。
実行する内容
開始するには、以下を実行してください:
bash
コードをコピー
コードをクリップボードにコピー
npx intlayer initこれにより、必要な Intlayer セットアップファイルが作成されます。バックグラウンドで Intlayer を使用するように切り替えるには、next.config.ts を更新してください:
next.config.ts
コードをコピー
コードをクリップボードにコピー
import type { NextConfig } from "next";import { createNextI18nPlugin } from "@intlayer/next-i18next/plugin";const withIntlayer = createNextI18nPlugin();const nextConfig: NextConfig = {};export default withIntlayer(nextConfig);仕組みの詳細
createNextI18nPlugin は Next.js のネイティブな動作と core next-intlayer プラグインを合成し、next-i18next、react-i18next、i18next に必要なすべての Webpack/Turbopack エイリアスをインジェクトします。
仕組みの詳細:
serverSideTranslations&appWithTranslation: これらは Intlayer の内部ローダーのラッパーとして機能し、大規模な静的 JSON インジェクションを回避します。- Client hooks:
@intlayer/react-i18nextに直接委譲され、すべてのフォーマット、複数形、およびネストされた namespace 機能を保持します。