mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2025-01-09 04:22:12 -08:00
30 lines
645 B
JavaScript
30 lines
645 B
JavaScript
// HACK FIXME
|
|
|
|
let lang
|
|
|
|
export async function loadLanguage() {
|
|
lang = await window.api.Lang.getLang()
|
|
}
|
|
|
|
export function query(id, placeHolders){
|
|
let query = id.split('.')
|
|
let res = lang
|
|
for(let q of query){
|
|
res = res[q]
|
|
}
|
|
let text = res === lang ? '' : res
|
|
if (placeHolders) {
|
|
Object.entries(placeHolders).forEach(([key, value]) => {
|
|
text = text.replace(`{${key}}`, value)
|
|
})
|
|
}
|
|
return text
|
|
}
|
|
|
|
export function queryJS(id, placeHolders){
|
|
return query(`js.${id}`, placeHolders)
|
|
}
|
|
|
|
export function queryEJS(id, placeHolders){
|
|
return query(`ejs.${id}`, placeHolders)
|
|
} |