mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 08:36:38 +00:00
It will use the english as default rather than tell you the value is not exist if there's no translation for currently language
This commit is contained in:
parent
89bd4b9aeb
commit
1f7f13ffe1
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user