Skip to content

Commit 76b1378

Browse files
fix: populate domainLocales based on module config (#3694) (#3695)
Co-authored-by: Bobbie Goede <bobbiegoede@gmail.com>
1 parent 01064fe commit 76b1378

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/prepare/runtime-config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ export function prepareRuntimeConfig({ options }: I18nNuxtContext, nuxt: Nuxt) {
2020
locales: options.locales,
2121
detectBrowserLanguage: options.detectBrowserLanguage ?? DEFAULT_OPTIONS.detectBrowserLanguage,
2222
experimental: options.experimental,
23-
multiDomainLocales: options.multiDomainLocales
23+
multiDomainLocales: options.multiDomainLocales,
24+
domainLocales: Object.fromEntries(
25+
options.locales.map(l => {
26+
if (typeof l === 'string') {
27+
return [l, { domain: '' }]
28+
}
29+
return [l.code, { domain: l.domain ?? '' }]
30+
})
31+
)
2432
// TODO: we should support more i18n module options. welcome PRs :-)
2533
})
2634
}

0 commit comments

Comments
 (0)