-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable prefetching lazy locales
- Loading branch information
1 parent
72082ff
commit aebda0a
Showing
5 changed files
with
85 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createResolver, defineNuxtModule } from '@nuxt/kit' | ||
|
||
export default defineNuxtModule({ | ||
async setup(options, nuxt) { | ||
const { resolve } = createResolver(import.meta.url) | ||
nuxt.hook('i18n:registerModule', register => { | ||
register({ | ||
langDir: resolve('./locales'), | ||
locales: [ | ||
{ | ||
code: 'nl', | ||
iso: 'nl-NL', | ||
file: 'lazy-locale-module-nl.ts', | ||
name: 'Nederlands' | ||
} | ||
] | ||
}) | ||
}) | ||
} | ||
}) |
3 changes: 3 additions & 0 deletions
3
specs/fixtures/lazy/i18n-module/locales/lazy-locale-module-nl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default defineI18nLocale(locale => ({ | ||
moduleLayerText: 'This is a merged module layer locale key in Dutch' | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
import i18nModule from './i18n-module' | ||
|
||
// https://nuxt.com/docs/guide/directory-structure/nuxt.config | ||
export default defineNuxtConfig({ | ||
modules: ['@nuxtjs/i18n'], | ||
|
||
modules: [i18nModule, '@nuxtjs/i18n'], | ||
i18n: { | ||
baseUrl: 'http://localhost:3000', | ||
// langDir: 'lang', | ||
// defaultLocale: 'fr', | ||
detectBrowserLanguage: false, | ||
experimental: { | ||
jsTsFormatResource: true | ||
}, | ||
compilation: { | ||
strictMessage: false | ||
}, | ||
defaultLocale: 'en', | ||
langDir: 'lang', | ||
defaultLocale: 'fr', | ||
detectBrowserLanguage: false | ||
lazy: true, | ||
locales: [ | ||
{ | ||
code: 'en', | ||
iso: 'en-US', | ||
file: 'lazy-locale-en.json', | ||
name: 'English' | ||
}, | ||
{ | ||
code: 'en-GB', | ||
iso: 'en-GB', | ||
files: ['lazy-locale-en.json', 'lazy-locale-en-GB.js', 'lazy-locale-en-GB.ts'], | ||
name: 'English (UK)' | ||
}, | ||
{ | ||
code: 'fr', | ||
iso: 'fr-FR', | ||
file: 'lazy-locale-fr.json5', | ||
name: 'Français' | ||
} | ||
] | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters