Skip to content

Commit fe6d114

Browse files
committed
feat: add global options
1 parent 83b398e commit fe6d114

File tree

2 files changed

+33
-34
lines changed

2 files changed

+33
-34
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function (userOptions) {
3131
const pluginsPath = join(__dirname, PLUGINS_DIR)
3232
const templatesPath = join(__dirname, TEMPLATES_DIR)
3333
const requiredPlugins = ['main', 'routing']
34-
const options = { ...DEFAULT_OPTIONS, ...userOptions }
34+
const options = { ...DEFAULT_OPTIONS, ...userOptions, ...this.options.i18n }
3535
// Options that have nested config options must be merged
3636
// individually with defaults to prevent missing options
3737
for (const key of NESTED_OPTIONS) {

test/fixtures/basic/nuxt.config.js

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,38 @@ module.exports = {
44
render: {
55
resourceHints: false
66
},
7-
modules: [
8-
['@@', {
9-
seo: true,
10-
baseUrl: 'nuxt-app.localhost',
11-
locales: [
12-
{
13-
code: 'en',
14-
iso: 'en-US',
15-
name: 'English'
7+
modules: ['@@'],
8+
i18n: {
9+
seo: true,
10+
baseUrl: 'nuxt-app.localhost',
11+
locales: [
12+
{
13+
code: 'en',
14+
iso: 'en-US',
15+
name: 'English'
16+
},
17+
{
18+
code: 'fr',
19+
iso: 'fr-FR',
20+
name: 'Français'
21+
}
22+
],
23+
defaultLocale: 'en',
24+
lazy: false,
25+
vueI18n: {
26+
messages: {
27+
fr: {
28+
home: 'Accueil',
29+
about: 'À propos',
30+
posts: 'Articles'
1631
},
17-
{
18-
code: 'fr',
19-
iso: 'fr-FR',
20-
name: 'Français'
32+
en: {
33+
home: 'Homepage',
34+
about: 'About us',
35+
posts: 'Posts'
2136
}
22-
],
23-
defaultLocale: 'en',
24-
lazy: false,
25-
vueI18n: {
26-
messages: {
27-
fr: {
28-
home: 'Accueil',
29-
about: 'À propos',
30-
posts: 'Articles'
31-
},
32-
en: {
33-
home: 'Homepage',
34-
about: 'About us',
35-
posts: 'Posts'
36-
}
37-
},
38-
fallbackLocale: 'en'
39-
}
40-
}]
41-
]
37+
},
38+
fallbackLocale: 'en'
39+
}
40+
}
4241
}

0 commit comments

Comments
 (0)