From 41ddbb66a9f7fb6a2f062d86ab2fe5993b610b36 Mon Sep 17 00:00:00 2001 From: mnvdk Date: Sun, 26 Apr 2020 18:13:59 +0200 Subject: [PATCH] load category strings in its own object instead of just overwriting everything --- public/src/js/strings.js | 15 +++++++-------- public/src/js/titlescreen.js | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/public/src/js/strings.js b/public/src/js/strings.js index cb51297..3a5d63e 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -1074,11 +1074,11 @@ var translations = { } } var categories = {} + var allStrings = {} +var categoryStrings = {} function separateStrings(){ - let categoriesTemp = Object.assign({}, categories); - categories = {} for(var j in languageList){ var lang = languageList[j] @@ -1106,12 +1106,11 @@ function separateStrings(){ translateObj(translations[i], i, str) } - categories[lang] = { - id: lang - } - var str = categories[lang] - for(var i in categoriesTemp){ - translateObj(categoriesTemp[i], i, str) + categoryStrings[lang] = {} + var str = categoryStrings[lang] + + for(var i in categories){ + translateObj(categories[i], i, str) } } } diff --git a/public/src/js/titlescreen.js b/public/src/js/titlescreen.js index da73ac9..b818725 100644 --- a/public/src/js/titlescreen.js +++ b/public/src/js/titlescreen.js @@ -78,13 +78,13 @@ class Titlescreen{ } setLang(){ let stringLang = allStrings[settings.getItem("language")] - let categoryLang = categories[settings.getItem("language")] - + let categoryLang = categoryStrings[settings.getItem("language")] + strings = stringLang strings.categories = categoryLang settings.setLang(stringLang, true, allStrings) - settings.setLang(categoryLang, true, categories) + settings.setLang(categoryLang, true, categoryStrings) let boldFonts = strings.font === "Microsoft YaHei, sans-serif" loader.screen.style.fontFamily = strings.font