summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-31 04:01:35 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-31 04:01:35 +0300
commit092b060edacfbb79df3dcf66d7b71b79813aeb45 (patch)
tree1f1f8a59fa3db4f4b7b0d8d53803244c32165793 /src
parent6b0dd77da68d844633654a71bd1ae64250d36497 (diff)
downloadmanaverse-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.gz
manaverse-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.bz2
manaverse-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.xz
manaverse-092b060edacfbb79df3dcf66d7b71b79813aeb45.zip
store gettext information to log.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp21
-rw-r--r--src/client.h2
2 files changed, 19 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 3b4bc3203..858c7ff49 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -331,7 +331,7 @@ void Client::gameInit()
putenv((char*)("LANGUAGE=" + lang).c_str());
// mingw doesn't like LOCALEDIR to be defined for some reason
if (lang != "C")
- bindtextdomain("manaplus", "translations/");
+ bindTextDomain("manaplus", "translations/");
#else
if (!lang.empty())
{
@@ -339,13 +339,17 @@ void Client::gameInit()
putenv(const_cast<char*>(("LANGUAGE=" + lang).c_str()));
}
#ifdef ENABLE_PORTABLE
- bindtextdomain("manaplus", (std::string(PHYSFS_getBaseDir())
+ bindTextDomain("manaplus", (std::string(PHYSFS_getBaseDir())
+ "../locale/").c_str());
#else
- bindtextdomain("manaplus", LOCALEDIR);
+ bindTextDomain("manaplus", LOCALEDIR);
#endif
#endif
- setlocale(LC_MESSAGES, lang.c_str());
+ char *locale = setlocale(LC_MESSAGES, lang.c_str());
+ if (locale)
+ logger->log("locale: %s", locale);
+ else
+ logger->log("locale empty");
bind_textdomain_codeset("manaplus", "UTF-8");
textdomain("manaplus");
#endif
@@ -666,6 +670,15 @@ Client::~Client()
testsClear();
}
+void Client::bindTextDomain(char *name, char *path)
+{
+ const char *const dir = bindtextdomain(name, path);
+ if (dir)
+ logger->log("bindtextdomain: %s", dir);
+ else
+ logger->log("bindtextdomain failed");
+}
+
void Client::testsClear()
{
if (!mOptions.test.empty())
diff --git a/src/client.h b/src/client.h
index add0ac958..c6427a720 100644
--- a/src/client.h
+++ b/src/client.h
@@ -348,6 +348,8 @@ private:
static Client *mInstance;
+ static void bindTextDomain(char *name, char *path);
+
Options mOptions;
std::string mPackageDir;