1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Translate access denied strings (#14842)

This commit is contained in:
1F616EMO~nya 2024-08-18 01:48:54 +08:00 committed by GitHub
parent 1fb49e9ca7
commit 5acc2736db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View file

@ -48,6 +48,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "particles.h"
#include <memory>
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.