Home

Issue: 525

integration of vue-i18n

[issue link]

Hey guys,

is it possible to inject custom properties to the root vue instance?
I want to use the vue-i18n plugin and the missing part is only the property on the root vue instance.
I found the generated file .nuxt/index.js. I added the missing property for a test like this:

.nuxt/index.js

...
import i18n from '~plugins/vue-i18n'
...

const app = {
...
i18n
...
}

plugins/vue-i18n.js

import Vue from 'vue'
import VueI18n from 'vue-i18n'

Vue.use(VueI18n)

export default new VueI18n({
  locale: 'de',
  fallbackLocale: 'en'
})

It’s working, but this file regenerated on every restart.
I found the right template for this file in nuxt.js/lib/app/index.js, but is it possible to add something without a fork?

This question is available on Nuxt.js community (#c456)