summaryrefslogtreecommitdiff
path: root/src/utils/langs.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-05 19:03:59 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-05 19:03:59 +0300
commit3b4ffd7199d990d1cbd0e7cbe23fa41f04d38e74 (patch)
treefe7ab920632207462354714e12604e2064d059ea /src/utils/langs.cpp
parentd8a530e299b4dd04c020ca3e3eeda7b12f89b69b (diff)
downloadmanaverse-3b4ffd7199d990d1cbd0e7cbe23fa41f04d38e74.tar.gz
manaverse-3b4ffd7199d990d1cbd0e7cbe23fa41f04d38e74.tar.bz2
manaverse-3b4ffd7199d990d1cbd0e7cbe23fa41f04d38e74.tar.xz
manaverse-3b4ffd7199d990d1cbd0e7cbe23fa41f04d38e74.zip
Add chat command for translate message from player language to english.
Also add po field into languages.xml.
Diffstat (limited to 'src/utils/langs.cpp')
-rw-r--r--src/utils/langs.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp
index 41545ac52..8aa452077 100644
--- a/src/utils/langs.cpp
+++ b/src/utils/langs.cpp
@@ -20,8 +20,16 @@
#include "utils/langs.h"
+#include "logger.h"
+
#include "configuration.h"
+#ifndef DYECMD
+#include "being/playerinfo.h"
+
+#include "resources/db/languagedb.h"
+#endif // DYECMD
+
#include "debug.h"
static const char *getLangName()
@@ -58,6 +66,23 @@ LangVect getLang()
return langs;
}
+LangVect getServerLang()
+{
+ LangVect langs;
+#ifndef DYECMD
+ const int id = PlayerInfo::getServerLanguage();
+ std::string lang = LanguageDb::getPo(id);
+ if (lang.empty())
+ return langs;
+ langs.push_back(lang);
+ const size_t idx = lang.find('_');
+ if (idx != std::string::npos)
+ langs.push_back(lang.substr(0, idx));
+#endif // DYECMD
+
+ return langs;
+}
+
std::string getLangSimple()
{
const std::string lang = config.getStringValue("lang");