Fix:Initial language code setting eventBus not yet defined

This commit is contained in:
advplyr 2024-02-16 09:12:47 -06:00
parent ce528d4012
commit a13217dddf
2 changed files with 6 additions and 6 deletions

View File

@ -84,7 +84,7 @@ async function loadi18n(code) {
Vue.prototype.$setDateFnsLocale(languageCodeMap[code].dateFnsLocale) Vue.prototype.$setDateFnsLocale(languageCodeMap[code].dateFnsLocale)
this.$eventBus.$emit('change-lang', code) this?.$eventBus?.$emit('change-lang', code)
return true return true
} }

View File

@ -156,14 +156,14 @@ Vue.prototype.$copyToClipboard = (str, ctx) => {
} }
function xmlToJson(xml) { function xmlToJson(xml) {
const json = {}; const json = {}
for (const res of xml.matchAll(/(?:<(\w*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<(\w*)(?:\s*)*\/>/gm)) { for (const res of xml.matchAll(/(?:<(\w*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<(\w*)(?:\s*)*\/>/gm)) {
const key = res[1] || res[3]; const key = res[1] || res[3]
const value = res[2] && xmlToJson(res[2]); const value = res[2] && xmlToJson(res[2])
json[key] = ((value && Object.keys(value).length) ? value : res[2]) || null; json[key] = ((value && Object.keys(value).length) ? value : res[2]) || null
} }
return json; return json
} }
Vue.prototype.$xmlToJson = xmlToJson Vue.prototype.$xmlToJson = xmlToJson