Skip to content

nuxt example implementation #110

@AbbasHasani

Description

@AbbasHasani

hi
trying to add vuex-i18n to my nuxt project no luck so far .
i'm getting this error message,

Cannot set property $i18n of [object Object] which has only a getter

my code so far :

import Vue from 'vue'
import Vuex from 'vuex'
// load and register the vuex i18n module
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'

const doDebug = process.env.NODE_ENV !== 'production'

const store = new Vuex.Store({
  strict: doDebug
})

Vue.use(
  vuexI18n.plugin,
  store,
  {
    onTranslationNotFound: function (locale, key) {
      console.warn(`vuex-i18n :: Key '${key}' not found for locale '${locale}'`)
    }
  })

  import { english } from '~/static/i18n/en.json'
  import { farsi } from '~/static/i18n/fa.json'
  
  Vue.i18n.add('en', english);
  Vue.i18n.add('fa', farsi);
  
Vue.i18n.set('fa')
Vue.i18n.fallback('fa')

export default store




Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions