We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b5f3aa7 commit 8116353Copy full SHA for 8116353
src/runtime/nuxt/plugin/defaultsWaitI18n.ts
@@ -1,5 +1,5 @@
1
import { applyDefaults } from '../logic/applyDefaults'
2
-import { defineNuxtPlugin, ref } from '#imports'
+import { defineNuxtPlugin, ref, useSiteConfig } from '#imports'
3
4
export default defineNuxtPlugin({
5
name: 'nuxt-seo:defaults',
@@ -12,9 +12,12 @@ export default defineNuxtPlugin({
12
? [
13
'nuxt-site-config:i18n',
14
]
15
- : [],
+ : [
16
+ 'i18n:plugin',
17
+ ],
18
setup(nuxtApp) {
- const locale = ref(nuxtApp.$i18n!.locale.value)
19
+ const siteConfig = useSiteConfig()
20
+ const locale = ref(nuxtApp.$i18n?.locale?.value || siteConfig.currentLocale || siteConfig.defaultLocale)
21
// @ts-expect-error untyped
22
nuxtApp.hook('i18n:localeSwitched', ({ newLocale }) => {
23
locale.value = newLocale
0 commit comments