mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-23 04:02:14 -08:00
26 lines
557 B
JavaScript
26 lines
557 B
JavaScript
/**
|
|
* @author Daniel D. Scalzi
|
|
* @license CC-BY-NC 4.0 - https://creativecommons.org/licenses/by-nc/4.0/
|
|
*/
|
|
|
|
const fs = require('fs-extra')
|
|
const path = require('path')
|
|
|
|
let lang
|
|
|
|
exports.loadLanguage = function(id){
|
|
lang = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'lang', `${id}.json`))) || {}
|
|
}
|
|
|
|
exports.query = function(id){
|
|
let query = id.split('.')
|
|
let res = lang
|
|
for(let q of query){
|
|
res = res[q]
|
|
}
|
|
return res === lang ? {} : res
|
|
}
|
|
|
|
exports.queryJS = function(id){
|
|
return exports.query(`js.${id}`)
|
|
} |