mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
example vue-i18n
This commit is contained in:
parent
c5b8d16a2b
commit
27336d4741
5
examples/vue-i18n/lang/en.json
Normal file
5
examples/vue-i18n/lang/en.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"welcome": "Welcome"
|
||||||
|
}
|
||||||
|
}
|
5
examples/vue-i18n/lang/fr.json
Normal file
5
examples/vue-i18n/lang/fr.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"welcome": "Bienvenue"
|
||||||
|
}
|
||||||
|
}
|
7
examples/vue-i18n/middleware/vue-i18n.js
Normal file
7
examples/vue-i18n/middleware/vue-i18n.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// import Vue from 'vue'
|
||||||
|
|
||||||
|
export default function ({ params }) {
|
||||||
|
console.log(params)
|
||||||
|
// if (params)
|
||||||
|
// Vue.config.lang = 'en'
|
||||||
|
}
|
6
examples/vue-i18n/nuxt.config.js
Normal file
6
examples/vue-i18n/nuxt.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
build: {
|
||||||
|
vendor: ['vue-i18n']
|
||||||
|
},
|
||||||
|
plugins: ['~plugins/vue-i18n']
|
||||||
|
}
|
12
examples/vue-i18n/package.json
Normal file
12
examples/vue-i18n/package.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "vue-i18n",
|
||||||
|
"dependencies": {
|
||||||
|
"nuxt": "latest",
|
||||||
|
"vue-i18n": "latest"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "nuxt",
|
||||||
|
"build": "nuxt build",
|
||||||
|
"start": "nuxt start"
|
||||||
|
}
|
||||||
|
}
|
3
examples/vue-i18n/pages/_lang/index.vue
Normal file
3
examples/vue-i18n/pages/_lang/index.vue
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<p v-html="$t('message.welcome')"></p>
|
||||||
|
</template>
|
6
examples/vue-i18n/plugins/vue-i18n.js
Normal file
6
examples/vue-i18n/plugins/vue-i18n.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
if (process.BROWSER_BUILD) {
|
||||||
|
var VueI18n = require('vue-i18n')
|
||||||
|
Vue.use(VueI18n)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user