Commit 9ed1bb9b authored by Secretboy-SMR's avatar Secretboy-SMR Committed by Melledy
Browse files

It will use the english as default rather than tell you the value is not exist...

It will use the english as default rather than tell you the value is not exist if there's no translation for currently language
parent d215035f
......@@ -160,7 +160,9 @@ public final class Language {
JsonObject object = this.languageData;
int index = 0;
String result = "This value does not exist. Please report this to the Discord: " + key;
String valueNotFoundPattern = "This value does not exist. Please report this to the Discord: ";
String result = valueNotFoundPattern + key;
boolean isValueFound = false;
while (true) {
if(index == keys.length) break;
......@@ -171,10 +173,18 @@ public final class Language {
if(element.isJsonObject())
object = element.getAsJsonObject();
else {
isValueFound = true;
result = element.getAsString(); break;
}
} else break;
}
if (!isValueFound && !languageCode.equals("en-US")) {
var englishValue = Grasscutter.getLanguage("en-US").get(key);
if (!englishValue.contains(valueNotFoundPattern)) {
result += "\nhere is english version:\n" + englishValue;
}
}
this.cachedTranslations.put(key, result); return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment