diff --git a/front/src/App.vue b/front/src/App.vue index babe359b0173c171bf122ab9e61e006478aaff0b..705ed9cf366c82530661a76028ddbcc2c44d1e8c 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -9,6 +9,7 @@ <div class="three wide column"> <h4 class="ui header">Links</h4> <div class="ui link list"> + <p>{{ $t('Hello, world!') }}</p> <router-link class="item" to="/about"> About this instance </router-link> @@ -49,7 +50,8 @@ export default { PlaylistModal }, created () { - console.log(this.$t('hello')) + this.$i18n.i18next.changeLanguage('fr') + console.log(this.$t('Hello, world!')) this.$store.dispatch('instance/fetchSettings') let self = this setInterval(() => { diff --git a/front/src/main.js b/front/src/main.js index aa63944fcbafd4b7229c15eca410d4f80f187032..ae51dd0a3e01e329bbd0ef682c5b4ad6efd678ce 100644 --- a/front/src/main.js +++ b/front/src/main.js @@ -12,7 +12,7 @@ import axios from 'axios' import {VueMasonryPlugin} from 'vue-masonry' import VueLazyload from 'vue-lazyload' import i18next from 'i18next' -// import i18nextFetch from 'i18next-fetch-backend' +import i18nextFetch from 'i18next-fetch-backend' import VueI18Next from '@panter/vue-i18next' import store from './store' import config from './config' @@ -83,21 +83,15 @@ axios.interceptors.response.use(function (response) { store.dispatch('auth/check') // i18n -i18next.init({ - lng: 'en', - resources: { - en: { - translation: { - 'hello': 'Hello' - } - }, - fr: { - translation: { - 'hello': 'Bonjour' - } +i18next + .use(i18nextFetch) + .init({ + lng: 'en', + preload: ['en'], + backend: { + loadPath: '/static/translations/{{lng}}.json' } - } -}) + }) const i18n = new VueI18Next(i18next) /* eslint-disable no-new */ diff --git a/front/static/translations/en.json b/front/static/translations/en.json index 9e26dfeeb6e641a33dae4961196235bdb965b21b..d0c92662cc6bbbcf4795b53e7d457b86a69f36c7 100644 --- a/front/static/translations/en.json +++ b/front/static/translations/en.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "Hello, world!": "Hello, world!" +} \ No newline at end of file diff --git a/front/static/translations/fr.json b/front/static/translations/fr.json index 9e26dfeeb6e641a33dae4961196235bdb965b21b..9b97d0eab8ea204287234f98290f09637f42fb13 100644 --- a/front/static/translations/fr.json +++ b/front/static/translations/fr.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "Hello, world!": "Bonjour tout le monde !" +} \ No newline at end of file diff --git a/po/en.po b/po/en.po index 32fbd17350b2c113b9008302cc399e920c2778f4..992e828280db331b99bca3ebc40d3c4455a6c7b6 100644 --- a/po/en.po +++ b/po/en.po @@ -11,3 +11,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "Hello, world!" +msgstr "Hello, world!" diff --git a/po/fr.po b/po/fr.po index 3dbbce54ce6bf132335222000fd573c0c9da7e22..95690711609e0206c7396bb209828ed0033910ec 100644 --- a/po/fr.po +++ b/po/fr.po @@ -11,3 +11,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" + +msgid "Hello, world!" +msgstr "Bonjour tout le monde !" diff --git a/po/funkwhale.pot b/po/funkwhale.pot index b5480d50981970a743eb13a7b97f03c12f4a8296..131959d465fe55a72f76125e1e53cef20d8b0c5f 100644 --- a/po/funkwhale.pot +++ b/po/funkwhale.pot @@ -11,3 +11,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +msgid "Hello, world!" +msgstr "Hello, world!"