Scenario
I'm working on a Nuxt 4 project using @nuxtjs/i18n 10.1.0. My translations are organized by namespace β each feature area has its own subdirectory under i18n/locales/:
i18n/locales/
βββ en.json β global keys
βββ zh.json
βββ home/
β βββ en.json β $t('home.gallery.collection')
β βββ zh.json
βββ workspace/
β βββ en.json β $t('workspace.export.title')
β βββ zh.json
βββ assets/
βββ config/
βββ dialog/
βββ error/
βββ generate/
βββ guide/
βββ ... β ~20 namespace directories in total
My .vscode/settings.json:
"i18n-ally.localesPaths": ["i18n/locales"],
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{namespace?}/?{locale}.json",
"i18n-ally.keystyle": "nested"
Problem
After installing i18n Ally v2.13.1, the extension appears activated (icon shows in Activity Bar), but:
- Sidebar shows 0 keys in use
- No inline translation annotations in
.vue files
- Output panel stops at
π Initializing loader "..." with no further output β no error, no warning
The extension fails completely silently.
Investigation
-
Checked Output panel (i18n Ally) β log stops abruptly after π Initializing loader, missing expected subsequent lines like π Directory structure:, π Loading locales under, β
Loading finished
-
Opened Developer Tools (Cmd+Shift+P β Developer: Toggle Developer Tools) β Console shows:
Activating extension 'lokalise.i18n-ally' failed: Invalid language tag: home.
-
Traced through the source code β the crash occurs in LocaleLoader.guessDirStructure():
const positives = dirnames
.map(d => Config.tagSystem.lookup(d))
Config.tagSystem.lookup() calls Intl.getCanonicalLocales() internally. When it encounters a directory named home (which is not a valid BCP47 language tag), Intl.getCanonicalLocales('home') throws RangeError: Invalid language tag: home.
This exception is not caught anywhere in the call chain (guessDirStructure β init β initLoader β update β updateRootPath), causing the entire extension activation to fail.
Root cause
Same as #701 (reported Dec 2021, still open). The guessDirStructure() method assumes all subdirectory names under localesPaths are either valid locale codes or will be handled gracefully. In reality, namespace-based directory structures (which is a common pattern and even documented in the i18n Ally wiki) produce directory names like home, assets, dialog that are not valid BCP47 tags.
Suggested fix
Wrap the lookup call in a try-catch so invalid tags are treated as non-locale directories (which is the correct behavior for the "guess" logic):
const positives = dirnames
.map((d) => {
try {
return Config.tagSystem.lookup(d)
} catch {
return undefined
}
})
Workaround
Explicitly set "i18n-ally.dirStructure": "file" to skip guessDirStructure() entirely.
Environment
- i18n Ally: v2.13.1
- VS Code: latest
- OS: macOS (Darwin 25.2.0)
- Framework:
@nuxtjs/i18n 10.1.0 (Nuxt 4 / Vue 3)
Scenario
I'm working on a Nuxt 4 project using
@nuxtjs/i18n10.1.0. My translations are organized by namespace β each feature area has its own subdirectory underi18n/locales/:My
.vscode/settings.json:Problem
After installing i18n Ally v2.13.1, the extension appears activated (icon shows in Activity Bar), but:
.vuefilesπ Initializing loader "..."with no further output β no error, no warningThe extension fails completely silently.
Investigation
Checked Output panel (
i18n Ally) β log stops abruptly afterπ Initializing loader, missing expected subsequent lines likeπ Directory structure:,π Loading locales under,β Loading finishedOpened Developer Tools (
Cmd+Shift+PβDeveloper: Toggle Developer Tools) β Console shows:Traced through the source code β the crash occurs in
LocaleLoader.guessDirStructure():Config.tagSystem.lookup()callsIntl.getCanonicalLocales()internally. When it encounters a directory namedhome(which is not a valid BCP47 language tag),Intl.getCanonicalLocales('home')throwsRangeError: Invalid language tag: home.This exception is not caught anywhere in the call chain (
guessDirStructureβinitβinitLoaderβupdateβupdateRootPath), causing the entire extension activation to fail.Root cause
Same as #701 (reported Dec 2021, still open). The
guessDirStructure()method assumes all subdirectory names underlocalesPathsare either valid locale codes or will be handled gracefully. In reality, namespace-based directory structures (which is a common pattern and even documented in the i18n Ally wiki) produce directory names likehome,assets,dialogthat are not valid BCP47 tags.Suggested fix
Wrap the
lookupcall in a try-catch so invalid tags are treated as non-locale directories (which is the correct behavior for the "guess" logic):Workaround
Explicitly set
"i18n-ally.dirStructure": "file"to skipguessDirStructure()entirely.Environment
@nuxtjs/i18n10.1.0 (Nuxt 4 / Vue 3)