Language detection

This commit is contained in:
Bat 2018-04-13 14:01:23 +01:00
parent 4bc866f98d
commit e3cfab8bb4
4 changed files with 10 additions and 11 deletions

View File

@ -20,7 +20,6 @@
"dateformat": "^2.0.0", "dateformat": "^2.0.0",
"django-channels": "^1.1.6", "django-channels": "^1.1.6",
"i18next": "^11.1.1", "i18next": "^11.1.1",
"i18next-browser-languagedetector": "^2.2.0",
"i18next-conv": "^6.0.0", "i18next-conv": "^6.0.0",
"i18next-fetch-backend": "^0.1.0", "i18next-fetch-backend": "^0.1.0",
"js-logger": "^1.3.0", "js-logger": "^1.3.0",

View File

@ -50,7 +50,7 @@ export default {
PlaylistModal PlaylistModal
}, },
created () { created () {
this.$i18n.i18next.changeLanguage('fr') // this.$i18n.i18next.changeLanguage('fr')
console.log(this.$t('Hello, world!')) console.log(this.$t('Hello, world!'))
this.$store.dispatch('instance/fetchSettings') this.$store.dispatch('instance/fetchSettings')
let self = this let self = this

View File

@ -86,9 +86,9 @@ store.dispatch('auth/check')
i18next i18next
.use(i18nextFetch) .use(i18nextFetch)
.init({ .init({
lng: 'en', lng: navigator.language,
fallbackLng: ['en'], fallbackLng: ['en'],
preload: ['en'], preload: [navigator.language, 'en'],
backend: { backend: {
loadPath: '/static/translations/{{lng}}.json' loadPath: '/static/translations/{{lng}}.json'
} }

View File

@ -6469,9 +6469,9 @@ showdown@^1.8.6:
dependencies: dependencies:
yargs "^10.0.3" yargs "^10.0.3"
shvl@^1.2.0: shvl@^1.3.0:
version "1.2.1" version "1.3.1"
resolved "https://registry.yarnpkg.com/shvl/-/shvl-1.2.1.tgz#7ea96257475b20cb69d2a58897c0640c93973593" resolved "https://registry.yarnpkg.com/shvl/-/shvl-1.3.1.tgz#6c20a17b4a20b08e9f8cab60c50a92229fcc176e"
sigmund@^1.0.1: sigmund@^1.0.1:
version "1.0.1" version "1.0.1"
@ -7359,12 +7359,12 @@ vuedraggable@^2.14.1:
dependencies: dependencies:
sortablejs "^1.7.0" sortablejs "^1.7.0"
vuex-persistedstate@^2.4.2: vuex-persistedstate@^2.5.2:
version "2.5.1" version "2.5.2"
resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-2.5.1.tgz#129274514e2e46b49e8ca8066cf85b345c7b4ce2" resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-2.5.2.tgz#751752f03bdf6d7fc855106f0666f2ce13b415b5"
dependencies: dependencies:
deepmerge "^2.1.0" deepmerge "^2.1.0"
shvl "^1.2.0" shvl "^1.3.0"
vuex-router-sync@^5.0.0: vuex-router-sync@^5.0.0:
version "5.0.0" version "5.0.0"