diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-31 04:01:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-31 04:01:35 +0300 |
commit | 092b060edacfbb79df3dcf66d7b71b79813aeb45 (patch) | |
tree | 1f1f8a59fa3db4f4b7b0d8d53803244c32165793 | |
parent | 6b0dd77da68d844633654a71bd1ae64250d36497 (diff) | |
download | mv-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.gz mv-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.bz2 mv-092b060edacfbb79df3dcf66d7b71b79813aeb45.tar.xz mv-092b060edacfbb79df3dcf66d7b71b79813aeb45.zip |
store gettext information to log.
-rw-r--r-- | src/client.cpp | 21 | ||||
-rw-r--r-- | src/client.h | 2 |
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; |