You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
561 B
23 lines
561 B
1 year ago
|
let lang = {
|
||
|
'zh-Hans': require('./zh-hans'),
|
||
|
en: require('./en')
|
||
|
}
|
||
|
|
||
|
function mergeLanguage (lang1, lang2) {
|
||
|
const localeList = Object.keys(lang1)
|
||
|
localeList.push(...Object.keys(lang2))
|
||
|
const result = {}
|
||
|
for (let i = 0; i < localeList.length; i++) {
|
||
|
const locale = localeList[i]
|
||
|
result[locale] = Object.assign({}, lang1[locale], lang2[locale])
|
||
|
}
|
||
|
return result
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
const langPath = require.resolve('uni-config-center/uni-id/lang/index.js')
|
||
|
lang = mergeLanguage(lang, require(langPath))
|
||
|
} catch (error) { }
|
||
|
|
||
|
module.exports = lang
|