mirror of
https://github.com/earthjasonlin/zzz-signal-search-export.git
synced 2024-11-23 05:40:21 +08:00
fix: i18n show empty string
This commit is contained in:
parent
d732d523a8
commit
2a670c7023
@ -42,14 +42,24 @@ const parseData = (data) => {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const assignData = (objA, objB) => {
|
||||||
|
const temp = { ...objA }
|
||||||
|
for (let key in objB) {
|
||||||
|
if (objB[key]) {
|
||||||
|
temp[key] = objB[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return temp
|
||||||
|
}
|
||||||
|
|
||||||
const i18nMap = new Map()
|
const i18nMap = new Map()
|
||||||
const prepareData = () => {
|
const prepareData = () => {
|
||||||
for (let key in raw) {
|
for (let key in raw) {
|
||||||
let temp = {}
|
let temp = {}
|
||||||
if (key === 'zh-tw') {
|
if (key === 'zh-tw') {
|
||||||
Object.assign(temp, raw['zh-cn'], raw[key])
|
temp = assignData(raw['zh-cn'], raw[key])
|
||||||
} else {
|
} else {
|
||||||
Object.assign(temp, raw['zh-cn'], raw['en-us'], raw[key])
|
temp = assignData(raw['zh-cn'], assignData(raw['en-us'], raw[key]))
|
||||||
}
|
}
|
||||||
i18nMap.set(key, parseData(temp))
|
i18nMap.set(key, parseData(temp))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user