const i18n = new I18n({
locale: 'zh',
fallbackLocale: 'zh',
messages: {
zh: {
hello: "你好 世界",
say: {
thanks: "{name} 谢谢"
}
},
en: {
hello: "hello world",
say: {
thanks: "thanks {name}"
}
}
}
});
i18n.t('hello') // 你好 世界
i18n.t('say.thanks', {name: 'xiaohong'}) // xiaohong 谢谢