---
title: "JSS Next.jsアプリにおける国際ルーティング"
slug: "internationalized-routing-in-jss-next-js-apps"
abstract: "多言語対応JSS Next.jsアプリにおけるルーティングの概要"
---
# JSS Next.jsアプリにおける国際ルーティング

国際化(i18n)ルーティングは [、JSS Next.jsアプリにおける通常のページルーティング](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/routing-and-page-composition-in-jss-next-js-apps.html "Routing and page composition in JSS Next.js apps") と似ていますが、ルーティングプロセスに新たなロケーションや言語の側面を加えます。

Next.jsには[i18nルーティング](https://nextjs.org/docs/advanced-features/i18n-routing)のサポートが組み込まれています。 [JSS Next.jsアプリケーションでi18nを設定する](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/internationalization-in-the-jss-sample-app-for-next-js.html "Internationalization in the JSS sample app for Next.js") 際:

-   contextオブジェクトはNext.jsルートlocaleを含みます。
-   [レイアウトサービス](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/layout-service.html "Layout Service")はsc\_langパラメータを通じてlocaleを受け取ります。

[ロケーション間の移行](https://nextjs.org/docs/advanced-features/i18n-routing#transition-between-locales)には、next/linkモジュールまたはnext/routerモジュールのLinkコンポーネントを使用します。

<languageEmbedding>設定はSitecoreで設定できます。設定は内部リンクから言語プレフィックス(サブパスルート)を返すためにasNeededまたはalwaysに設定されSitecore必要があります。JSSが提供するLinkコンポーネントはNext.jsから来る内部リンクのi18nルート遷移を処理Sitecore。

Next.js JSSサンプルアプリを基に作成されたJSS Next.jsアプリケーションは、デフォルトでサブパスルーティングを使用しています。Next.jsドメイン [ルーティング](https://nextjs.org/docs/advanced-features/i18n-routing#domain-routing)をサポートしていますが、JSS Next.jsアプリでこの戦略を使うにはカスタム実装が必要です。

> !重要静的HTMLエクスポートプロセス( next/exportまたはJSS CLIコマンドjss export)は多言語アプリをサポートしていません。 [アプリケーションを静的HTMLファイルとしてエクスポート](https://doc.sitecore.com/xp/ja/developers/hd/19/sitecore-headless-development/walkthrough--export-a-jss-next-js-app-to-static-html-files-with-next-export.html "Walkthrough: Export a JSS Next.js app to static HTML files with next export") するにはローカライズを無効にする必要があります。