- Fix: choose language : added flags

This commit is contained in:
Paolo Arena
2019-02-16 02:01:17 +01:00
parent ffe3fce52b
commit ea18c4e5b9
14 changed files with 226 additions and 54 deletions

View File

@@ -1,10 +1,15 @@
// src/plugins/i18n.js
import VueI18n from 'vue-i18n';
import messages from 'src/statics/i18n';
import { rescodes } from "../store/Modules/rescodes";
export default ({ app, store, Vue }) => {
Vue.use(VueI18n);
Vue.config.lang = process.env.LANG_DEFAULT;
// Vue.config.lang = process.env.LANG_DEFAULT;
let mylang = localStorage.getItem(rescodes.localStorage.lang)
if (mylang === '')
mylang = process.env.LANG_DEFAULT;
Vue.config.lang = mylang
// console.log("PLUGINS INIT....");
@@ -13,8 +18,9 @@ export default ({ app, store, Vue }) => {
// Set i18n instance on app
app.i18n = new VueI18n({
locale: process.env.LANG_DEFAULT,
fallbackLocale: process.env.LANG_DEFAULT,
locale: mylang,
fallbackLocale: mylang,
messages
})
}