Move i18n to vue-i18n and json files

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-12 11:34:01 +02:00
parent c3b03a2e6b
commit 96380f7df2
47 changed files with 740 additions and 1803 deletions

View File

@@ -2,14 +2,13 @@
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import Buefy from 'buefy';
import GetTextPlugin from 'vue-gettext';
import VueI18n from 'vue-i18n';
import App from '@/App.vue';
import router from '@/router';
import { apolloProvider } from './vue-apollo';
import { NotifierPlugin } from '@/plugins/notifier';
import filters from '@/filters';
const translations = require('@/i18n/translations.json');
import messages from '@/i18n/index';
Vue.config.productionTip = false;
@@ -19,13 +18,12 @@ Vue.use(filters);
const language = (window.navigator as any).userLanguage || window.navigator.language;
Vue.use(GetTextPlugin, {
translations,
defaultLanguage: 'en_US',
silent: true,
});
Vue.use(VueI18n);
Vue.config.language = language.replace('-', '_');
const i18n = new VueI18n({
locale: language.replace('-', '_'), // set locale
messages, // set locale messages
});
/* eslint-disable no-new */
new Vue({
@@ -34,4 +32,5 @@ new Vue({
el: '#app',
template: '<App/>',
components: { App },
i18n,
});