mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-27 08:36:38 +00:00
fixed language not found prompt
This commit is contained in:
parent
2cd1d32fbe
commit
6be39eafd2
@ -44,6 +44,13 @@ public final class LanguageCommand implements CommandHandler {
|
||||
actualLangCode = languageInst.getLanguageCode();
|
||||
Grasscutter.setLanguage(languageInst);
|
||||
}
|
||||
|
||||
if (!langCode.equals(actualLangCode)) {
|
||||
// I think there is no necessary to register this in language files
|
||||
// since this will always be english
|
||||
CommandHandler.sendMessage(sender, "currently, server does not have that language: " + langCode);
|
||||
}
|
||||
|
||||
CommandHandler.sendMessage(sender, translate(sender, "commands.language.language_changed", actualLangCode));
|
||||
|
||||
}
|
||||
|
@ -125,23 +125,23 @@ public final class Language {
|
||||
InputStream file = Grasscutter.class.getResourceAsStream("/languages/" + fileName);
|
||||
|
||||
if (file == null) { // Provided fallback language.
|
||||
Grasscutter.getLogger().warn("Failed to load language file: " + fileName + ", falling back to: " + fallback);
|
||||
actualLanguageCode = fallbackLanguageCode;
|
||||
if (cachedLanguages.containsKey(actualLanguageCode)) {
|
||||
return new LanguageStreamDescription(actualLanguageCode, null);
|
||||
}
|
||||
|
||||
file = Grasscutter.class.getResourceAsStream("/languages/" + fallback);
|
||||
Grasscutter.getLogger().warn("Failed to load language file: " + fileName + ", falling back to: " + fallback);
|
||||
}
|
||||
|
||||
if(file == null) { // Fallback the fallback language.
|
||||
Grasscutter.getLogger().warn("Failed to load language file: " + fallback + ", falling back to: en-US.json");
|
||||
actualLanguageCode = "en-US";
|
||||
if (cachedLanguages.containsKey(actualLanguageCode)) {
|
||||
return new LanguageStreamDescription(actualLanguageCode, null);
|
||||
}
|
||||
|
||||
file = Grasscutter.class.getResourceAsStream("/languages/en-US.json");
|
||||
Grasscutter.getLogger().warn("Failed to load language file: " + fallback + ", falling back to: en-US.json");
|
||||
}
|
||||
|
||||
if(file == null)
|
||||
|
Loading…
Reference in New Issue
Block a user