Code Monkey home page Code Monkey logo

Comments (9)

tikiatua avatar tikiatua commented on May 24, 2024 1

Hi @infinite-dao,

Please try using import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'; to load the vuex-i18n plugin.

We changed the default file to the es-version, which is probably why you are seeing the token error message.

from vuex-i18n.

infinite-dao avatar infinite-dao commented on May 24, 2024

Indeed import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'; brings the translations to work.

Thanks @tikiatua

from vuex-i18n.

tikiatua avatar tikiatua commented on May 24, 2024

Great. I will add a respective comment to the readme file tomorrow

from vuex-i18n.

 avatar commented on May 24, 2024

Hi, got the same error. Using VueJS together with VuetifyJS.

import vuexI18n from 'vuex-i18n'
Uncaught SyntaxError: Unexpected token export

import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
vuex-i18n.umd.js?65ee:388 i18n vuex module is not correctly initialized. Please check the module name: i18n
main.js?3b76:23 Uncaught TypeError: Cannot read property 'add' of undefined

from vuex-i18n.

tikiatua avatar tikiatua commented on May 24, 2024

Hi @SgtPepper27,

Thank you for reporting this. Could you please indicate the version of vuex-i18n that you are using and post the part of the main file where you are initializing the module.

// as example 
import Vue from 'vue';
import Vuex from 'vuex';
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js';

const store = new Vuex.Store();
Vue.use(vuexI18n.plugin, store);

from vuex-i18n.

 avatar commented on May 24, 2024

Version: 1.10.1

index.js (Store):

import Vue from 'vue'
import Vuex from 'vuex'
import { vuex } from '../modules'
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
import translationEN from '../languages/locale-en.json'

Vue.use(Vuex)

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

const store = new Vuex.Store({
  modules: vuex,
  strict: debug
})

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

// register the locales
Vue.i18n.add('en', translationEN)

// Set the start locale to use
Vue.i18n.set('en')

export default store
  

from vuex-i18n.

tikiatua avatar tikiatua commented on May 24, 2024

Strange. The code looks fine to me so far (although I would not use Vuex and vuex as variables).

Are you using server-side-rendering or running this in the browser?

Please try the following things:

  1. use the latest version of vuex.i18n (1.10.1). In this version the plugin is properly name-spaced and preserves existing module state. Maybe this was a source of the problem. If you already started with this version, please try to use version 1.9.0.

  2. make sure you run an up-to-date version of vuex (just to be sure).

  3. try to specify the module name explicitly with the option moduleName. The configuration should actually be merged, but maybe something does not work correctly with Object.extend().

Vue.use(vuexI18n.plugin, store, {
	moduleName: 'i18n',
	onTranslationNotFound: ...
)

from vuex-i18n.

 avatar commented on May 24, 2024

Hey,

Thanks for the quick reply. Using this with VueJS/VuetifyJS as an electron app.

Your advice of using version 1.9.0 works for me. Last thing i have to check is, if i am using the last version of vuex but for the moment i am happy

from vuex-i18n.

tikiatua avatar tikiatua commented on May 24, 2024

Thank you for the feedback. This means we broke something with 1.10. I will take a look at the differences between the versions.

from vuex-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.