diff --git a/nuxt.config.ts b/nuxt.config.ts index 2e947f3..badd666 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -54,6 +54,7 @@ const config: NuxtConfig = { ], plugins: [ + { src: '@/plugins/router.js' }, { src: '@/plugins/vuelidate.js' }, { src: '@/plugins/application.js' } ], @@ -68,6 +69,7 @@ const config: NuxtConfig = { { code: 'ja', iso: 'ja-JP', name: '日本語', file: 'ja-JP.json' } ], lazy: true, + skipSettingLocaleOnNavigate: true, langDir: 'locales/', defaultLocale: 'ja', vueI18n: { diff --git a/plugins/router.js b/plugins/router.js new file mode 100644 index 0000000..67a3b3e --- /dev/null +++ b/plugins/router.js @@ -0,0 +1,5 @@ +export default ({ app }) => { + app.nuxt.defaultTransition.beforeEnter = () => { + app.i18n.finalizePendingLocaleChange() + } +} \ No newline at end of file