aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorEkdohibs <nathanael.courant@laposte.net>2017-01-31 18:05:03 +0100
committerEkdohibs <nathanael.courant@laposte.net>2017-08-24 17:54:10 +0200
commitb24e6433df3c3b2926568aff9c0173459e3e8eab (patch)
treeeec6a9f05e78e3de7b08c805685cd54dcc5e43de /src/network
parentb28af0ed0777f66122ecaf0d0e302fe24c88d552 (diff)
downloadminetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.tar.gz
minetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.tar.bz2
minetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.zip
Add clientside translations.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp8
-rw-r--r--src/network/serverpackethandler.cpp5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 4800ea87c..f42f9219b 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/serialize.h"
#include "util/srp.h"
#include "tileanimation.h"
+#include "gettext.h"
void Client::handleCommand_Deprecated(NetworkPacket* pkt)
{
@@ -123,7 +124,12 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
<< m_recommended_send_interval<<std::endl;
// Reply to server
- NetworkPacket resp_pkt(TOSERVER_INIT2, 0);
+ std::string lang = gettext("LANG_CODE");
+ if (lang == "LANG_CODE")
+ lang = "";
+
+ NetworkPacket resp_pkt(TOSERVER_INIT2, sizeof(u16) + lang.size());
+ resp_pkt << lang;
Send(&resp_pkt);
m_state = LC_Init;
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 09e04674c..5ed38d6d7 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -612,6 +612,9 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
m_clients.event(pkt->getPeerId(), CSE_GotInit2);
u16 protocol_version = m_clients.getProtocolVersion(pkt->getPeerId());
+ std::string lang;
+ if (pkt->getSize() > 0)
+ *pkt >> lang;
/*
Send some initialization data
@@ -632,7 +635,7 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
m_clients.event(pkt->getPeerId(), CSE_SetDefinitionsSent);
// Send media announcement
- sendMediaAnnouncement(pkt->getPeerId());
+ sendMediaAnnouncement(pkt->getPeerId(), lang);
// Send detached inventories
sendDetachedInventories(pkt->getPeerId());