title: $:/plugins/oeyoews/vue-i18n/readme

<!-- jsdelivr 和 unpkg 大小不同，文件较小的有问题 -->

!! Usage

```js
// widget.js
// $t is enabled default, but you can use t to simplify it
const { createI18n } = require('vue-i18n.global.prod.js');

const en = require('./i18n/en.js');
const cn = require('./i18n/zh.js');
const messages = {
  English: en,
  中文: cn
};

const defaultLang = 'English'
let locale = localStorage.getItem('lang');
if (!locale) {
  locale = defaultLang;
  localStorage.setItem('lang', locale);
}

const i18n = createI18n({
  legacy: false,
  locale,
  fallbackLocale: defaultLang,
  messages
});
app.use(i18n);

// app.js (optional)
const { useI18n } = require('vue-i18n.global.prod.js');
setup () {
  const { t } = useI18n();
  return { t }
}
```

!! Links
* https://vue-i18n.intlify.dev/guide/installation.html
* https://vue-i18n.intlify.dev/guide/essentials/syntax.html
* https://github.com/LeonWuV/FE-blog-repository/blob/master/vue/vue%20--%20vue-i18n%E5%9B%BD%E9%99%85%E5%8C%96%E4%BD%BF%E7%94%A8%E7%AE%80%E5%8D%95%E6%95%99%E7%A8%8B.md
