martinlindhe / laravel-vue-i18n-generator

Generates a vue-i18n compatible include file from your Laravel translations
MIT License
306 stars 207 forks source link

store.registerModule is not a function #33

Closed Naoray closed 7 years ago

Naoray commented 7 years ago

First I tried using vue-i18n package. After facing same error as described in #29 I tried that approach, but still it didn't work... got this instead:

image

any idea?

Naoray commented 7 years ago

Ok it was vuex related... according to vuex#45 their synthax has changed. So here is my setup (btw. I am using Spark):

require('spark-bootstrap');

import Vuex from 'vuex';
import vuexI18n from 'vuex-i18n';
import Locales from './vue-i18n-locales.generated.js';

const store = new Vuex.Store();

Vue.use(vuexI18n.plugin, store);

Vue.i18n.add('en', Locales.en);
Vue.i18n.add('de', Locales.de);

// set the start locale to use
Vue.i18n.set(Spark.locale);

require('./components/bootstrap');

var app = new Vue({
    store,
    mixins: [require('spark')]
});
<!-- Global Spark Object -->
    <script>
        window.Spark = <?php echo json_encode(array_merge(
            Spark::scriptVariables(), [
                'loggedIn' => Auth::check(),
                'locale' => config('app.locale')
            ]
        )); ?>;
    </script>