Fix for translation errors

This commit is contained in:
KingRainbow44
2022-05-06 21:52:10 -04:00
parent f34100924e
commit 043c731575
3 changed files with 9 additions and 3 deletions

View File

@@ -29,7 +29,13 @@ public final class Language {
* @return A translated value with arguments substituted.
*/
public static String translate(String key, Object... args) {
return Grasscutter.getLanguage().get(key).formatted(args);
String translated = Grasscutter.getLanguage().get(key);
try {
return translated.formatted(args);
} catch (Exception exception) {
Grasscutter.getLogger().error("Failed to format string: " + key, exception);
return translated;
}
}
/**