feat: add default translate for i18n

This commit is contained in:
YunYouJun 2021-08-28 23:32:23 +08:00
parent d4911be55d
commit 2132fb5cf2
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ export const t = (key: string, messages: Object) => {
const keyArr = key.split('.')
const name = keyArr.shift()
if (!keyArr.length) {
return messages[name]
return messages[name] || name
} else {
return t(keyArr.join('.'), messages[name])
}