Closed RezaErfani67 closed 4 years ago
I never use vue-i18n
before, but you can try the code below:
i18n.js file for example
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n);
const messages = {
'en': {
username: 'Chen',
...
},
'cn': {
username: '陈',
...
}
}
export default new VueI18n({
locale: 'en', // set locale
fallbackLocale: 'cn', // set fallback locale
messages, // set locale messages
})
Your vue file
<template>
<div v-text="i18n('username')"></div>
</template>
<script>
import i18n from './i18n'
export default {
methods: {
i18n (key) {
return i18n.t(key)
}
}
}
</script>
Hope these can help you.
yes... thanks a lot @TerryZ God Bless You
i write this code
return below error