🌍 inspire by vue-i18n-loader
It works just like 'vue-i18n-loader'
- 'i18n' tag will be removed
- content in 'i18n' tag will be merge into target json file(s)
- support using 'extend' to cover content in 'i18n' tag
- support using 'extend' to translate content into different language
npm install vue-i18n-loader2 --save-dev
- in Vue component
<i18>
{
"zh-cn": {
"Hello": "Hello"
}
}
</i18>
- in webpack config
vueLoaderConfig.loaders['i18n'] = [{
loader: 'vue-i18n-extend-loader',
options: {
target: 'src/lang', // require
character: 'utf-8', // default: utf-8
extend: {
'zh-cn': {
'Hello': '你们好'
},
en: {
'Hello': 'Hello everyone'
}
}
}
}]
- zh-cn.json
{"Hello": "你们好"}
- en.json
{"Hello": "Hello everyone"}
- Import these json file to project with 'vue-i18n' or 'vue-i18n-async'
- vue-i18n-async https://github.com/chiaweilee/vue-i18n-async