mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 13:19:59 +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;
|
JsonObject object = this.languageData;
|
||||||
|
|
||||||
int index = 0;
|
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) {
|
while (true) {
|
||||||
if(index == keys.length) break;
|
if(index == keys.length) break;
|
||||||
@ -171,11 +173,19 @@ public final class Language {
|
|||||||
if(element.isJsonObject())
|
if(element.isJsonObject())
|
||||||
object = element.getAsJsonObject();
|
object = element.getAsJsonObject();
|
||||||
else {
|
else {
|
||||||
|
isValueFound = true;
|
||||||
result = element.getAsString(); break;
|
result = element.getAsString(); break;
|
||||||
}
|
}
|
||||||
} else 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;
|
this.cachedTranslations.put(key, result); return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user