Skip to content

Commit a016440

Browse files
authoredOct 5, 2024··
fix: vueI18n resolution not using restructureDir defaults (#3159)
1 parent 989d775 commit a016440

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed
 
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// https://nuxt.com/docs/guide/directory-structure/nuxt.config
22
export default defineNuxtConfig({
33
compatibilityDate: '2024-04-03',
4-
modules: ['@nuxtjs/i18n']
4+
modules: ['@nuxtjs/i18n'],
5+
i18n: {
6+
restructureDir: false
7+
}
58
})

‎specs/fixtures/restructure/nuxt.config.ts

-4
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ export default defineNuxtConfig({
2424
modules: [i18nModule, '@nuxtjs/i18n'],
2525

2626
i18n: {
27-
restructureDir: false,
2827
baseUrl: 'http://localhost:3000',
29-
// langDir: 'lang',
30-
// defaultLocale: 'fr',
3128
detectBrowserLanguage: false,
3229
compilation: {
3330
strictMessage: false
3431
},
35-
restructureDir: 'i18n',
3632
defaultLocale: 'en',
3733
lazy: true,
3834
locales: [

‎src/layers.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export const mergeLayerPages = (analyzer: (pathOverride: string) => void, nuxt:
8989
}
9090

9191
export function resolveI18nDir(layer: NuxtConfigLayer, i18n: NuxtI18nOptions, fromRootDir: boolean = false) {
92-
if (i18n.restructureDir) {
93-
return resolve(layer.config.rootDir, i18n.restructureDir)
92+
if (i18n.restructureDir !== false) {
93+
return resolve(layer.config.rootDir, i18n.restructureDir ?? 'i18n')
9494
}
9595

9696
return resolve(layer.config.rootDir, fromRootDir ? '' : layer.config.srcDir)
@@ -153,9 +153,9 @@ export const getLayerLangPaths = (nuxt: Nuxt) => {
153153

154154
for (const layer of nuxt.options._layers) {
155155
const i18n = getLayerI18n(layer)
156-
if (!i18n?.restructureDir && i18n?.langDir == null) continue
156+
if (i18n?.restructureDir === false && i18n?.langDir == null) continue
157157

158-
langPaths.push(resolveLayerLangDir(layer, i18n))
158+
langPaths.push(resolveLayerLangDir(layer, i18n || {}))
159159
}
160160

161161
return langPaths

0 commit comments

Comments
 (0)
Please sign in to comment.