Skip to content

Commit 8fe5bf4

Browse files
committed
fix(i18n): ブラウザ言語の振り分けをルートだけに限る
nuxt-i18n v6 の既定は全ルートで振り分けるため、日本語端末で /en/ を開くと 日本語になっていた。i18n を導入した #299 の受け入れ条件に反する。 redirectOn: 'root' にすると / の自動振り分けは残り、明示の接頭辞は尊重される。
1 parent 013095a commit 8fe5bf4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

nuxt-i18n.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,13 @@ export default {
8686
bundle: {
8787
optimizeTranslationDirective: false
8888
},
89-
detectBrowserLanguage: false
89+
// 接頭辞なしの / に来たときだけブラウザの言語で振り分ける。
90+
// /en/ のように明示された接頭辞は尊重する(redirectOn: 'root')。
91+
// nuxt-i18n v6 の既定は全ルートで振り分けるため、日本語端末で /en/ を開くと
92+
// 日本語になっていた。これは i18n を導入した #299 の受け入れ条件に反する。
93+
detectBrowserLanguage: {
94+
useCookie: true,
95+
cookieKey: 'i18n_redirected',
96+
redirectOn: 'root'
97+
}
9098
}

0 commit comments

Comments
 (0)