Skip to content

Commit

Permalink
feat: add global options
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelreyrol committed May 4, 2019
1 parent 83b398e commit fe6d114
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (userOptions) {
const pluginsPath = join(__dirname, PLUGINS_DIR)
const templatesPath = join(__dirname, TEMPLATES_DIR)
const requiredPlugins = ['main', 'routing']
const options = { ...DEFAULT_OPTIONS, ...userOptions }
const options = { ...DEFAULT_OPTIONS, ...userOptions, ...this.options.i18n }
// Options that have nested config options must be merged
// individually with defaults to prevent missing options
for (const key of NESTED_OPTIONS) {
Expand Down
65 changes: 32 additions & 33 deletions test/fixtures/basic/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,38 @@ module.exports = {
render: {
resourceHints: false
},
modules: [
['@@', {
seo: true,
baseUrl: 'nuxt-app.localhost',
locales: [
{
code: 'en',
iso: 'en-US',
name: 'English'
modules: ['@@'],
i18n: {
seo: true,
baseUrl: 'nuxt-app.localhost',
locales: [
{
code: 'en',
iso: 'en-US',
name: 'English'
},
{
code: 'fr',
iso: 'fr-FR',
name: 'Français'
}
],
defaultLocale: 'en',
lazy: false,
vueI18n: {
messages: {
fr: {
home: 'Accueil',
about: 'À propos',
posts: 'Articles'
},
{
code: 'fr',
iso: 'fr-FR',
name: 'Français'
en: {
home: 'Homepage',
about: 'About us',
posts: 'Posts'
}
],
defaultLocale: 'en',
lazy: false,
vueI18n: {
messages: {
fr: {
home: 'Accueil',
about: 'À propos',
posts: 'Articles'
},
en: {
home: 'Homepage',
about: 'About us',
posts: 'Posts'
}
},
fallbackLocale: 'en'
}
}]
]
},
fallbackLocale: 'en'
}
}
}

0 comments on commit fe6d114

Please sign in to comment.