mirror of
https://github.com/minetest/minetest.git
synced 2024-11-26 17:43:45 +01:00
Translate access denied strings (#14842)
This commit is contained in:
parent
1fb49e9ca7
commit
5acc2736db
@ -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.
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user