diff --git a/app/assets/js/langloader.js b/app/assets/js/langloader.js index 866c9da8..e6606911 100644 --- a/app/assets/js/langloader.js +++ b/app/assets/js/langloader.js @@ -7,19 +7,25 @@ exports.loadLanguage = function(id){ lang = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'lang', `${id}.json`))) || {} } -exports.query = function(id){ +exports.query = function(id, placeHolders){ let query = id.split('.') let res = lang for(let q of query){ res = res[q] } - return res === lang ? {} : res + let text = res === lang ? '' : res + if (placeHolders) { + Object.entries(placeHolders).forEach(([key, value]) => { + text = text.replace(`{${key}}`, value) + }) + } + return text } -exports.queryJS = function(id){ - return exports.query(`js.${id}`) +exports.queryJS = function(id, placeHolders){ + return exports.query(`js.${id}`, placeHolders) } -exports.queryEJS = function(id){ - return exports.query(`ejs.${id}`) +exports.queryEJS = function(id, placeHolders){ + return exports.query(`ejs.${id}`, placeHolders) } \ No newline at end of file diff --git a/app/assets/lang/en_US.json b/app/assets/lang/en_US.json index debbb4b8..6a726bcb 100644 --- a/app/assets/lang/en_US.json +++ b/app/assets/lang/en_US.json @@ -122,7 +122,7 @@ "javaExecSelButtonText": "Choose File", "javaExecDesc": "The Java executable is validated before game launch.", "javaReqDesc": "Requires Java 8 x64.", - "javaPathDesc": "The path should end with bin<%= process.platform === 'win32' ? '\\\\javaw.exe' : '/java' %>.", + "javaPathDesc": "The path should end with {pathSuffix}.", "jvmOptsTitle": "Additional JVM Options", "jvmOptsDesc": "Options to be provided to the JVM at runtime. -Xms and -Xmx should not be included.", "jvmOptsLink": "https://docs.oracle.com/javase/8/docs/technotes/tools/<%= process.platform === 'win32' ? 'windows' : 'unix' %>/java.html", diff --git a/app/settings.ejs b/app/settings.ejs index a7446b98..18bec3c5 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -245,7 +245,7 @@ -