See #161: initial setup to collect/compile messages with vue-gettext

This commit is contained in:
Eliot Berriot 2018-06-30 11:11:45 +02:00
parent a1b8555c17
commit a0a75c9919
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
7 changed files with 381 additions and 10 deletions

View file

@ -15,7 +15,11 @@ import i18next from 'i18next'
import i18nextFetch from 'i18next-fetch-backend'
import VueI18Next from '@panter/vue-i18next'
import store from './store'
import GetTextPlugin from 'vue-gettext'
import { sync } from 'vuex-router-sync'
import translations from './translations.json'
import locales from '@/locales'
import filters from '@/filters' // eslint-disable-line
import globals from '@/components/globals' // eslint-disable-line
@ -29,6 +33,26 @@ window.$ = window.jQuery = require('jquery')
require('semantic-ui-css/semantic.js')
require('masonry-layout')
Vue.use(GetTextPlugin, {
availableLanguages: (function () {
let l = {}
locales.locales.forEach(c => {
l[c.code] = c.label
})
return l
})(),
defaultLanguage: 'en_US',
languageVmMixin: {
computed: {
currentKebabCase: function () {
return this.current.toLowerCase().replace('_', '-')
}
}
},
translations: translations,
silent: true
})
Vue.use(VueI18Next)
Vue.use(VueMasonryPlugin)
Vue.use(VueLazyload)