diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index e2bcb51b5..4b9e8ceea 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -48,6 +48,22 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "particles.h" #include +const char *accessDeniedStrings[SERVER_ACCESSDENIED_MAX] = { + N_("Invalid password"), + N_("Your client sent something the server didn't expect. Try reconnecting or updating your client."), + N_("The server is running in singleplayer mode. You cannot connect."), + N_("Your client's version is not supported.\nPlease contact the server administrator."), + N_("Player name contains disallowed characters"), + N_("Player name not allowed"), + N_("Too many users"), + N_("Empty passwords are disallowed. Set a password and try again."), + N_("Another client is connected with this name. If your client closed unexpectedly, try again in a minute."), + N_("Internal server error"), + "", + N_("Server shutting down"), + N_("The server has experienced an internal error. You will now be disconnected.") +}; + void Client::handleCommand_Deprecated(NetworkPacket* pkt) { infostream << "Got deprecated command " @@ -216,17 +232,17 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt) denyCode == SERVER_ACCESSDENIED_CRASH) { *pkt >> m_access_denied_reason; if (m_access_denied_reason.empty()) - m_access_denied_reason = accessDeniedStrings[denyCode]; + m_access_denied_reason = gettext(accessDeniedStrings[denyCode]); u8 reconnect; *pkt >> reconnect; m_access_denied_reconnect = reconnect & 1; } else if (denyCode == SERVER_ACCESSDENIED_CUSTOM_STRING) { *pkt >> m_access_denied_reason; } else if (denyCode == SERVER_ACCESSDENIED_TOO_MANY_USERS) { - m_access_denied_reason = accessDeniedStrings[denyCode]; + m_access_denied_reason = gettext(accessDeniedStrings[denyCode]); m_access_denied_reconnect = true; } else if (denyCode < SERVER_ACCESSDENIED_MAX) { - m_access_denied_reason = accessDeniedStrings[denyCode]; + m_access_denied_reason = gettext(accessDeniedStrings[denyCode]); } else { // Allow us to add new error messages to the // protocol without raising the protocol version, if we want to. diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index e3618042f..d84c735b8 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -1150,22 +1150,6 @@ enum NetProtoCompressionMode { NETPROTO_COMPRESSION_NONE = 0, }; -constexpr const char *accessDeniedStrings[SERVER_ACCESSDENIED_MAX] = { - "Invalid password", - "Your client sent something the server didn't expect. Try reconnecting or updating your client.", - "The server is running in simple singleplayer mode. You cannot connect.", - "Your client's version is not supported.\nPlease contact the server administrator.", - "Player name contains disallowed characters", - "Player name not allowed", - "Too many users", - "Empty passwords are disallowed. Set a password and try again.", - "Another client is connected with this name. If your client closed unexpectedly, try again in a minute.", - "Internal server error", - "", - "Server shutting down", - "The server has experienced an internal error. You will now be disconnected." -}; - enum PlayerListModifer : u8 { PLAYER_LIST_INIT,