diff options
author | Ekdohibs <nathanael.courant@laposte.net> | 2017-01-31 18:05:03 +0100 |
---|---|---|
committer | Ekdohibs <nathanael.courant@laposte.net> | 2017-08-24 17:54:10 +0200 |
commit | b24e6433df3c3b2926568aff9c0173459e3e8eab (patch) | |
tree | eec6a9f05e78e3de7b08c805685cd54dcc5e43de /src/client.cpp | |
parent | b28af0ed0777f66122ecaf0d0e302fe24c88d552 (diff) | |
download | minetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.tar.gz minetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.tar.bz2 minetest-b24e6433df3c3b2926568aff9c0173459e3e8eab.zip |
Add clientside translations.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp index 30c1ab4d5..658b10393 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -51,6 +51,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "script/scripting_client.h" #include "game.h" #include "chatmessage.h" +#include "translation.h" extern gui::IGUIEnvironment* guienv; @@ -684,8 +685,19 @@ bool Client::loadMedia(const std::string &data, const std::string &filename) return true; } - errorstream<<"Client: Don't know how to load file \"" - <<filename<<"\""<<std::endl; + const char *translate_ext[] = { + ".tr", NULL + }; + name = removeStringEnd(filename, translate_ext); + if (!name.empty()) { + verbosestream << "Client: Loading translation: " + << "\"" << filename << "\"" << std::endl; + g_translations->loadTranslation(data); + return true; + } + + errorstream << "Client: Don't know how to load file \"" + << filename << "\"" << std::endl; return false; } |