Make prototype accessible in vuex

I would call mutating Vuex prototype as a bad practice and in this case, it's really not necessary.

Simply create a file called localization.js and instantiate the i18n plugin in that file. Plus export a named function to return the same i18n instance.

// localization.js

const i18n = new VueI18n({ ... });

export const getLocalization = () => i18n;

export default i18n;

Then in your Vuex module import the getLocalization function and execute it to get the same i18n instance and do translations using it.

// vuex-module.js

import Vue from 'vue';
import Vuex from 'vuex';
import { getLocalization } from './localization';

Vue.use(Vuex);

const i18n = getLocalization();

export default {
  state: {
    criteria: i18n('translation.name'),
  },
}