@@ -25,19 +25,12 @@ export default defineNuxtPlugin({
2525
2626 const nuxt = useNuxtApp ( )
2727 const runtimeI18n = nuxt . $config . public . i18n as I18nPublicRuntimeConfig
28-
29- let defaultLocaleDomain : string = runtimeI18n . defaultLocale || ''
28+ const defaultLocale : string = getDefaultLocaleForDomain ( runtimeI18n . defaultLocale || '' )
3029 if ( __MULTI_DOMAIN_LOCALES__ ) {
31- defaultLocaleDomain = getDefaultLocaleForDomain ( runtimeI18n )
32- setupMultiDomainLocales ( defaultLocaleDomain )
30+ setupMultiDomainLocales ( defaultLocale )
3331 }
3432
35- runtimeI18n . defaultLocale = defaultLocaleDomain
36-
37- const vueI18nOptions : I18nOptions = await setupVueI18nOptions ( )
38- if ( defaultLocaleDomain ) {
39- vueI18nOptions . locale = defaultLocaleDomain
40- }
33+ const vueI18nOptions : I18nOptions = await setupVueI18nOptions ( defaultLocale )
4134
4235 if ( import . meta. server ) {
4336 const serverLocaleConfigs = useLocaleConfigs ( )
@@ -53,7 +46,7 @@ export default defineNuxtPlugin({
5346 // create i18n instance
5447 const i18n = createI18n ( vueI18nOptions )
5548
56- nuxt . _nuxtI18nCtx = createNuxtI18nContext ( nuxt , i18n )
49+ nuxt . _nuxtI18nCtx = createNuxtI18nContext ( nuxt , i18n , defaultLocale )
5750 const ctx = useNuxtI18nContext ( nuxt )
5851
5952 nuxt . _nuxtI18n = createComposableContext ( runtimeI18n )
@@ -97,7 +90,7 @@ export default defineNuxtPlugin({
9790 composer . loadLocaleMessages = ctx . loadLocaleMessages
9891
9992 composer . differentDomains = __DIFFERENT_DOMAINS__
100- composer . defaultLocale = runtimeI18n . defaultLocale
93+ composer . defaultLocale = defaultLocale
10194
10295 composer . getBrowserLocale = ctx . getBrowserLocale
10396 composer . getLocaleCookie = ctx . getLocaleCookie
0 commit comments