Skip to content

[BUG?]: Locale resolver scans srcDir instead of rootDir

Open

Description

In Nuxt 4 the srcDir will be app by default instead of being the same as the rootDir.
I want to put my lang directory outside of the app directory because I also use translations server side.

In the module setup it will scan the srcDir for the translation files but they are located outside of it.

i18n/src/module.ts

Lines 184 to 188 in cddb8b3

const localeInfo = await resolveLocales(
resolve(nuxt.options.srcDir),
normalizedLocales,
relative(nuxt.options.buildDir, nuxt.options.srcDir)
)

(The experimental.localeDetector, in contrast, does scan the rootDir)

const pathTo = resolve(serverI18nLayer.config.rootDir, serverI18nLayer.config.i18n!.experimental!.localeDetector!)

I tested the module with only changing the nuxt.options.srcDir to nuxt.options.rootDir and it works fine.
I hope this is the easy fix I think it is.

cc @danielroe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions