diff --git a/src/main.js b/src/main.js index e2a229c..a639ad1 100644 --- a/src/main.js +++ b/src/main.js @@ -49,7 +49,10 @@ import MobileCommand from './components/mobile/mobile-pages/Command.vue' Vue.use(VueAxios, axios) Vue.use(VueMaterial) Vue.use(Snotify) -Vue.use(VModal, { dialog: true, dynamic: true }) +Vue.use(VModal, { + dialog: true, + dynamic: true +}) Vue.use(VueTabs) // VueOnsen components @@ -90,6 +93,21 @@ if (token) { console.log('No authentication token found') } +// Map of navigator language with the corresponding value + +const mapLanguage = { + 'it-it': 'it', + 'en-en': 'en', + 'en': 'en', + 'nl': 'nl', + 'nl-be': 'nl', + 'ro': 'ro', + 'ro-mo': 'ro', + 'ru': 'ru', + 'ru-mo': 'ru', + 'sk': 'sk' +} + Vue.config.productionTip = false Vue.directive('focus', { @@ -106,5 +124,14 @@ new Vue({ router, store, template: '', - components: { App } + components: { + App + }, + mounted () { + // lowercase for new and old browser + const language = window.navigator.language.toLocaleLowerCase() + if (!(mapLanguage[language] === undefined)) { + this.$i18n.set(mapLanguage[language]) + } + } })