Comments (9)
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.
Indeed import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js';
brings the translations to work.
Thanks @tikiatua
from vuex-i18n.
Great. I will add a respective comment to the readme file tomorrow
from vuex-i18n.
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.
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.
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.
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:
-
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.
-
make sure you run an up-to-date version of vuex (just to be sure).
-
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.
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.
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)
- Support for yarn HOT 1
- What is the current version? HOT 3
- The v1.10.7 introduced a couple of breaking changes: Comparison vs v1.10.5 HOT 5
- Not able to access i18 plugin from mutation in classic mode store in Nuxt application HOT 1
- Usage of special characters inside the translations ( ) HOT 2
- Testing the fallback language - Chai HOT 2
- Single File Component Children not updating HOT 3
- Hook custom logic for non existent keys in lang HOT 2
- nuxt example implementation HOT 2
- Improve typescript declarations HOT 3
- Improve plugin documentation
- Multiple modules HOT 2
- What about provide plugin for debugging content HOT 1
- Using square brackets in identifier does not work HOT 2
- Linked local messages HOT 1
- Set Fallback language File HOT 5
- How to translate a component attribute/property
- Unicode-Support?
- support change language key before render ?
- Option to suppress the `i18n: Not all placeholders found` console warnings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuex-i18n.