Merge commit 'eb816e4a781d4684b7859ddc05004fb28c199f31' into i18n
This commit is contained in:
commit
1b8ccc1ee3
@ -34,8 +34,16 @@ export const getTemplateByKey = (key: string) => {
|
|||||||
if (Object.keys(message).includes(key)) {
|
if (Object.keys(message).includes(key)) {
|
||||||
return message[key]
|
return message[key]
|
||||||
}
|
}
|
||||||
console.error(`[i18n] Function getTemplateByKey(), key param ${key} is not existed.`)
|
|
||||||
return ''
|
try {
|
||||||
|
const keyList = key.split('.')
|
||||||
|
return keyList.reduce((pre, cur) => {
|
||||||
|
return pre[cur]
|
||||||
|
}, message)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`[i18n] Function getTemplateByKey(), key param ${key} is not existed.`)
|
||||||
|
return ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user