opened
NadhirBoukhenifra
username_0
Hello,
thank for this package (but its not working for me :) )
i get this message after make everything like description:

```
Uncaught TypeError: Vue.locale is not a function
    at app.js:18
    at Array.forEach (<anonymous>)
    at Object../resources/assets/js/app.js (app.js:17)
    at __webpack_require__ (bootstrap 1b252795b9032e827bb4:54)
    at Object.0 (app.js?id=549aa35d4febc37b4843:31457)
    at __webpack_require__ (bootstrap 1b252795b9032e827bb4:54)
    at webpackJsonpCallback (bootstrap 1b252795b9032e827bb4:25)
    at app.js?id=549aa35d4febc37b4843:1
```

and the package installed in fresh laravel 5.5 project.
error Vue.locale is not a function
issue
created
martinlindhe
username_1
I guess vue-i18n changed their API again. You should have better success if you pin it to version 5 or something, I hope.
comment
created
thmsbkkr
username_2
Hi Martin,

I came across this same error when trying to set it up. I'm using Vue, Vue-Router and Vuex.
Been searching for the solution on the github issues page of vue-i18n but haven't had any luck.

For what it's worth, here is my file.

```
import axios from 'axios'

axios.defaults.headers.common['X-CSRF-TOKEN'] = window.App.csrfToken;
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VeeValidate from 'vee-validate'
import VueInternalization from 'vue-i18n'
import Locales from './vue-i18n-locales.generated.js';

Vue.use(VueInternalization)
Vue.use(VeeValidate, { inject: false })

Vue.config.lang = 'en';

Object.keys(Locales).forEach(function (lang) {
    Vue.locale(lang, Locales[lang])
});

import router from './router'
import store from './store'
import App from './App.vue'

Vue.config.productionTip = false

/* eslint-disable no-new */
const app = new Vue({
    el: '#app',
    router,
    store,
    template: '<App/>',
    components: { App }
})
```

Thank you! :)
comment
created
martinlindhe
username_1
@username_2 as a work around you can use version 5 of vue-i18n
comment
created
Konafets
username_3
@username_1 Did you looked into this or still hitting the road :-)

I got around the error by the following code:

```js
import VueInternalization from 'vue-i18n';
import Locales from './vue-i18n-locales.generated.js';

Vue.use(VueInternalization);
const i18n = new VueInternalization(Locales);

import store from './vuex';

const app = new Vue({
    store, // inject store into all children
    el: '#app',
    i18n
});
```

But now I got this error:
`Cannot translate the value of keypath 'message.hello'. Use the value of keypath as default.`
comment
created
martinlindhe
username_1
@username_3 Nice work
no this has slipped my mind.
Great you got it working with vuex-i18n,
but I think we should try get it to work with the recent vue-i18n too
comment
created
Konafets
username_3
@username_1 I thought about to *fork* your lib by taking the generator part and make it compatible with vuex-i18n or would you be open to make your lib be compatible with both vuex-i18n and vue-i18n.

A big favor of vuex-i18n is, that it supports plural but that need some extra string replacement in the generator.
comment
created
martinlindhe
username_1
@username_3 I would gladly extend this lib to also work with vuex-i18n. However, from your post at https://github.com/username_1/laravel-vue-i18n-generator/issues/29#issue-264570535 I got the impression no fork was needed, only some different setup instructions, correct?
comment
created
Konafets
username_3
One difference between the libs is the way to handle pluralization. While vue-i18n does it the _Laravel way_ using the pipe symbol `|`, vuex-i18n uses three collons `person ::: people`. I would introduce a flag in the config to be able to switch between both libs and replace the `|` by `:::` when using vuex-i18n.
comment
created
martinlindhe
username_1
I see, sounds reasonable!
comment
closed
martinlindhe
username_1
issue
created
martinlindhe
username_1
Closing this as a dupe in favor for #40
comment