example vue-i18n

This commit is contained in:
Alexandre Chopin 2017-02-08 17:33:13 +01:00
parent c5b8d16a2b
commit 27336d4741
7 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,5 @@
{
"message": {
"welcome": "Welcome"
}
}

View File

@ -0,0 +1,5 @@
{
"message": {
"welcome": "Bienvenue"
}
}

View File

@ -0,0 +1,7 @@
// import Vue from 'vue'
export default function ({ params }) {
console.log(params)
// if (params)
// Vue.config.lang = 'en'
}

View File

@ -0,0 +1,6 @@
module.exports = {
build: {
vendor: ['vue-i18n']
},
plugins: ['~plugins/vue-i18n']
}

View File

@ -0,0 +1,12 @@
{
"name": "vue-i18n",
"dependencies": {
"nuxt": "latest",
"vue-i18n": "latest"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start"
}
}

View File

@ -0,0 +1,3 @@
<template>
<p v-html="$t('message.welcome')"></p>
</template>

View File

@ -0,0 +1,6 @@
import Vue from 'vue'
if (process.BROWSER_BUILD) {
var VueI18n = require('vue-i18n')
Vue.use(VueI18n)
}