Commit 0eab44f5 authored by 方块君's avatar 方块君 Committed by Melledy
Browse files

Add multilingual support

Add multilingual support
parent 86e6eef4
...@@ -52,21 +52,21 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler { ...@@ -52,21 +52,21 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler {
responseData.data.account.email = account.getEmail(); responseData.data.account.email = account.getEmail();
Grasscutter.getLogger() Grasscutter.getLogger()
.info(String.format("[Dispatch] Client %s failed to log in: Account %s created", .info(String.format(Grasscutter.getLanguage().Client_failed_login_account_create,
req.ip(), responseData.data.account.uid)); req.ip(), responseData.data.account.uid));
} else { } else {
responseData.retcode = -201; responseData.retcode = -201;
responseData.message = "Username not found, create failed."; responseData.message = Grasscutter.getLanguage().Username_not_found_create_failed;
Grasscutter.getLogger().info(String.format( Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Client_failed_login_account_create_failed
"[Dispatch] Client %s failed to log in: Account create failed", req.ip())); , req.ip()));
} }
} else { } else {
responseData.retcode = -201; responseData.retcode = -201;
responseData.message = "Username not found."; responseData.message = Grasscutter.getLanguage().Username_not_found;
Grasscutter.getLogger().info(String Grasscutter.getLogger().info(String
.format("[Dispatch] Client %s failed to log in: Account no found", req.ip())); .format(Grasscutter.getLanguage().Client_failed_login_account_no_found, req.ip()));
} }
} else { } else {
// Account was found, log the player in // Account was found, log the player in
...@@ -75,7 +75,7 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler { ...@@ -75,7 +75,7 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler {
responseData.data.account.token = account.generateSessionKey(); responseData.data.account.token = account.generateSessionKey();
responseData.data.account.email = account.getEmail(); responseData.data.account.email = account.getEmail();
Grasscutter.getLogger().info(String.format("[Dispatch] Client %s logged in as %s", req.ip(), Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Client_login, req.ip(),
responseData.data.account.uid)); responseData.data.account.uid));
} }
......
...@@ -72,7 +72,7 @@ public final class GameServer extends KcpServer { ...@@ -72,7 +72,7 @@ public final class GameServer extends KcpServer {
try { try {
onTick(); onTick();
} catch (Exception e) { } catch (Exception e) {
Grasscutter.getLogger().error("An error occurred during game update.", e); Grasscutter.getLogger().error(Grasscutter.getLanguage().An_error_occurred_during_game_update, e);
} }
} }
}, new Date(), 1000L); }, new Date(), 1000L);
...@@ -207,8 +207,8 @@ public final class GameServer extends KcpServer { ...@@ -207,8 +207,8 @@ public final class GameServer extends KcpServer {
@Override @Override
public void onStartFinish() { public void onStartFinish() {
Grasscutter.getLogger().info("Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter"); Grasscutter.getLogger().info(Grasscutter.getLanguage().grasscutter_is_free);
Grasscutter.getLogger().info("Game Server started on port " + address.getPort()); Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Game_start_port, address.getPort()));
ServerStartEvent event = new ServerStartEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call(); ServerStartEvent event = new ServerStartEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call();
} }
......
...@@ -113,12 +113,12 @@ public class GameSession extends KcpChannel { ...@@ -113,12 +113,12 @@ public class GameSession extends KcpChannel {
@Override @Override
protected void onConnect() { protected void onConnect() {
Grasscutter.getLogger().info("Client connected from " + getAddress().getHostString().toLowerCase()); Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Client_connect, getAddress().getHostString().toLowerCase()));
} }
@Override @Override
protected synchronized void onDisconnect() { // Synchronize so we dont add character at the same time protected synchronized void onDisconnect() { // Synchronize so we dont add character at the same time
Grasscutter.getLogger().info("Client disconnected from " + getAddress().getHostString().toLowerCase()); Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Client_disconnect, getAddress().getHostString().toLowerCase()));
// Set state so no more packets can be handled // Set state so no more packets can be handled
this.setState(SessionState.INACTIVE); this.setState(SessionState.INACTIVE);
......
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