summaryrefslogtreecommitdiff
path: root/src/utils/langs.cpp
diff options
context:
space:
mode:
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");