title: vue-i18n doesn't update locale after integrating vuex
body: <p>I'm still new to Vue, but I feel like I'm almost getting the hang of it.. I managed to create an app that could translate to different languages where the content was loaded from LANG.json files.. the problem was that whenever I changed to a new view then it would turn back to the original translation..</p>
  
  <p>So I tried to integrate Vuex to my application, but I can't seem to get it to work..</p>
  
  <p>I believe this is all the relevant code:</p>
  
  <p>src/i18n/index.js</p>
  
  <pre><code>import Vue from 'vue'
  import VueI18n from 'vue-i18n'
  import store from './../store'
  
  Vue.use(VueI18n)
  
  export default new VueI18n({
    locale: store.state.Language,
    messages: {
      'en': require('./en.json'),
      'cn': require('./cn.json')
    }
  })
  </code></pre>
  
  <p>src/store/index.js</p>
  
  <pre><code>import Vue from 'vue'
  import Vuex from 'vuex'
  
  Vue.use(Vuex)
  
  const actions = {
    changeLanguage: ({ commit }, data) =&gt; commit('changeLanguage', data)
  }
  
  const mutations = {
    changeLanguage (state, data) {
      this.state.Language = data
    }
  }
  
  const getters = {
    getLanguage: state =&gt; state.Language
  }
  
  const state = {
    Language: 'en'
  }
  
  export default new Vuex.Store({
    state,
    getters,
    actions,
    mutations
  })
  </code></pre>
  
  <p>src/main.js</p>
  
  <pre><code>[...]
  import store from './store'
  import i18n from './i18n'
  [...]
  new Vue({
    el: '#app',
    router,
    store,
    i18n,
    render: h =&gt; h(App)
  })
  </code></pre>
  
  <p>src/components/randomfile.js</p>
  
  <pre><code>&lt;template&gt;
  [...]
  &lt;button v-on:click="en"&gt;English&lt;/button&gt; 
  &lt;button v-on:click="cn"&gt;Chinese&lt;/button&gt;
  &lt;/template&gt;
  &lt;script&gt;
  export default {
    name: 'navFooter',
    data () {
      return {
      }
    },
    methods: {
      en: function () {
        console.log('change lang')
        this.$store.dispatch('changeLanguage', 'en')
        // this.$i18n.locale = 'en'
      },
      cn: function () {
        this.$store.dispatch('changeLanguage', 'cn')
        // this.$i18n.locale = 'cn'
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm guessing the problem is either related to this line: <code>locale: store.state.Language</code>, or because I'm doing something wrong with the dispatch, because in one of my views I write <code>{{$store.state.Language}}</code>, which renders to <code>en</code> on page load, but disappears after I click the buttons that call the methods for dispatching.</p>
  
  <p>I call the translations with <code>{{ $t('views.home.title') }}</code> but I'm pretty sure that's still the way they should be called after integrating vuex (store), and the translations do appear as they should, they just don't update after clicking the buttons that dispatch changeLanguage.</p>
  
  <p>Any help would be much appreciated</p>
  
  <hr>
  
  <p>Edit: Actually, it seems the way I translated did make a difference.. after changing it to <code>{{ $t('views.home.title', $store.state.Language) }}</code>  (maybe this should be <code>this.$store.state.Language</code>?)then the translations started working again.. but the translation state is still not persistent (meaning if I refresh the page or open a new URL, then it will change back to the English translations...</p>
  
  <p>Any ideas why that is?</p>