Closed JValck closed 6 years ago
The issue with both vue-i18n and vuex-i18n is they have changed their api several times by now, the README tries to document the various versions. I have no idea why they keep breaking the api:s.
I started looking into setting up example tests covering the various versions in order to have proper examples to point to, but never got around to finish it. Any kind of help would be very welcome!
I've just installed this on Laravel 5.6 and got:
"martinlindhe/laravel-vue-i18n-generator": "^0.1.28"
and "vue-i18n": "^7.6.0"
It took me a significant amount of time to figure out the correct way to initialize the translations, so here is what worked for me:
import Vue from 'vue';
import VueInternalization from 'vue-i18n';
import Locale from './vue-i18n-locales.generated';
Vue.use(VueInternalization);
const lang = document.documentElement.lang;
const i18n = new VueInternalization({
locale: lang.substr(0, 2),
messages: Locale
});
const app = new Vue({
el: '#app',
i18n,
components: {
...
}
}
Should I make a PR for the README?
@iben12 a PR updating the readme is very welcome!
Do you think I should add one more init help section or phase out the oldest and push one down?
I guess the one that says 'recent version' is the code for vue-i18n
< 6.x.
Since we're at 7.x now, I would suggest the latter.
Yea would be helpful to keep instructions for previous version for now, if you don't mind.
This was resolved in #49
The readme is quiet outdated. Maybe it's not a bad idea to give it an update? Below is an excerpt from the
app.js
. I updated it so others can find a small boilerplate for starting with this project easily. I'm also referencing #27 and #29 as those issues were similar to mine before getting it to work properly.As you can see I'm using vuex-i18n.
:bulb: Code