vue-i18n-min
v1.0.10
Published
```ts import i18n from 'vue-i18n-min';
Downloads
26
Readme
usage
import i18n from 'vue-i18n-min';
i18n.merge({
'en': {
hello: 'world',
},
'zh-cn': {
hello: '你好',
withArgs1: '{0} {1} {2}',
withArgs2: '{a} {b} {c}',
},
'zh-tw': {
hello: '世界'
}
});
i18n.merge('foo.bar.bzz', {
en: 'Enlish',
zhCn: '简体',
zhTw: '繁体',
});
// loader get called before lang changed
i18n.loader = async(lang: string) => {
// i18n.merge( ... )
}
export default i18n;
<template>
<div>{{ $t('hello') }}</div>
<div>{{ $t('foo.bar.bzz') }}</div>
<div>{{ $t('no exists', 'default value') }}</div>
<div>{{ $t('withArgs1', [1,2,3]) }}</div>
<div>{{ $t('withArgs2', {a,b,c}) }}</div>
</template>
<script setup lang="ts">
import i18n from '@/i18n';
i18n.lang = 'zh-cn';
app.use(i18n);
let a = 'aaa'
let b = 'bbb'
let c = 'ccc'
</script>