mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 12:42:52 +08:00
Fix for translation errors
This commit is contained in:
parent
f34100924e
commit
043c731575
@ -93,7 +93,7 @@ public final class Grasscutter {
|
||||
ResourceLoader.loadAll();
|
||||
ScriptLoader.init();
|
||||
|
||||
// Database
|
||||
// Initialize database.
|
||||
DatabaseManager.initialize();
|
||||
|
||||
// Create server instances.
|
||||
|
@ -334,7 +334,7 @@ public final class DispatchServer {
|
||||
return;
|
||||
}
|
||||
LoginResultJson responseData = new LoginResultJson();
|
||||
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_attempt"));
|
||||
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_token_attempt", req.ip()));
|
||||
|
||||
// Login
|
||||
Account account = DatabaseHelper.getAccountById(requestData.uid);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user