Setup translations with Vue
This commit is contained in:
		
							parent
							
								
									a4418bdcfe
								
							
						
					
					
						commit
						de753502c9
					
				|  | @ -35,7 +35,6 @@ htmlcov | ||||||
| 
 | 
 | ||||||
| # Translations | # Translations | ||||||
| *.mo | *.mo | ||||||
| *.pot |  | ||||||
| 
 | 
 | ||||||
| # Pycharm | # Pycharm | ||||||
| .idea | .idea | ||||||
|  |  | ||||||
|  | @ -39,7 +39,7 @@ | ||||||
|     "vue-upload-component": "^2.7.4", |     "vue-upload-component": "^2.7.4", | ||||||
|     "vuedraggable": "^2.14.1", |     "vuedraggable": "^2.14.1", | ||||||
|     "vuex": "^3.0.1", |     "vuex": "^3.0.1", | ||||||
|     "vuex-persistedstate": "^2.4.2", |     "vuex-persistedstate": "^2.5.2", | ||||||
|     "vuex-router-sync": "^5.0.0" |     "vuex-router-sync": "^5.0.0" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|  |  | ||||||
|  | @ -49,6 +49,7 @@ export default { | ||||||
|     PlaylistModal |     PlaylistModal | ||||||
|   }, |   }, | ||||||
|   created () { |   created () { | ||||||
|  |     console.log(this.$t('hello')) | ||||||
|     this.$store.dispatch('instance/fetchSettings') |     this.$store.dispatch('instance/fetchSettings') | ||||||
|     let self = this |     let self = this | ||||||
|     setInterval(() => { |     setInterval(() => { | ||||||
|  |  | ||||||
|  | @ -11,6 +11,9 @@ import router from './router' | ||||||
| import axios from 'axios' | import axios from 'axios' | ||||||
| import {VueMasonryPlugin} from 'vue-masonry' | import {VueMasonryPlugin} from 'vue-masonry' | ||||||
| import VueLazyload from 'vue-lazyload' | import VueLazyload from 'vue-lazyload' | ||||||
|  | import i18next from 'i18next' | ||||||
|  | // import i18nextFetch from 'i18next-fetch-backend'
 | ||||||
|  | import VueI18Next from '@panter/vue-i18next' | ||||||
| import store from './store' | import store from './store' | ||||||
| import config from './config' | import config from './config' | ||||||
| import { sync } from 'vuex-router-sync' | import { sync } from 'vuex-router-sync' | ||||||
|  | @ -27,6 +30,7 @@ window.$ = window.jQuery = require('jquery') | ||||||
| require('semantic-ui-css/semantic.js') | require('semantic-ui-css/semantic.js') | ||||||
| require('masonry-layout') | require('masonry-layout') | ||||||
| 
 | 
 | ||||||
|  | Vue.use(VueI18Next) | ||||||
| Vue.use(VueMasonryPlugin) | Vue.use(VueMasonryPlugin) | ||||||
| Vue.use(VueLazyload) | Vue.use(VueLazyload) | ||||||
| Vue.config.productionTip = false | Vue.config.productionTip = false | ||||||
|  | @ -77,11 +81,31 @@ axios.interceptors.response.use(function (response) { | ||||||
|   return Promise.reject(error) |   return Promise.reject(error) | ||||||
| }) | }) | ||||||
| store.dispatch('auth/check') | store.dispatch('auth/check') | ||||||
|  | 
 | ||||||
|  | // i18n
 | ||||||
|  | i18next.init({ | ||||||
|  |   lng: 'en', | ||||||
|  |   resources: { | ||||||
|  |     en: { | ||||||
|  |       translation: { | ||||||
|  |         'hello': 'Hello' | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     fr: { | ||||||
|  |       translation: { | ||||||
|  |         'hello': 'Bonjour' | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | }) | ||||||
|  | const i18n = new VueI18Next(i18next) | ||||||
|  | 
 | ||||||
| /* eslint-disable no-new */ | /* eslint-disable no-new */ | ||||||
| new Vue({ | new Vue({ | ||||||
|   el: '#app', |   el: '#app', | ||||||
|   router, |   router, | ||||||
|   store, |   store, | ||||||
|  |   i18n, | ||||||
|   template: '<App/>', |   template: '<App/>', | ||||||
|   components: { App } |   components: { App } | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | @ -0,0 +1,13 @@ | ||||||
|  | msgid "" | ||||||
|  | msgstr "" | ||||||
|  | "Project-Id-Version: Funkwhale 0.8\n" | ||||||
|  | "Report-Msgid-Bugs-To: \n" | ||||||
|  | "POT-Creation-Date: 2018-03-23 15:49-0700\n" | ||||||
|  | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||||
|  | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||||
|  | "Language-Team: LANGUAGE <LL@li.org>\n" | ||||||
|  | "Language: \n" | ||||||
|  | "MIME-Version: 1.0\n" | ||||||
|  | "Content-Type: text/plain; charset=UTF-8\n" | ||||||
|  | "Content-Transfer-Encoding: 8bit\n" | ||||||
|  | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | ||||||
		Loading…
	
		Reference in New Issue
	
	 Bat
						Bat