Commit 04f6e734 authored by Secretboy-SMR's avatar Secretboy-SMR Committed by Melledy
Browse files

fixed language not found prompt

parent 8ad6bda3
......@@ -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)
......
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