From 092b060edacfbb79df3dcf66d7b71b79813aeb45 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 31 Oct 2012 04:01:35 +0300 Subject: store gettext information to log. --- src/client.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/client.cpp') 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(("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()) -- cgit v1.2.3-60-g2f50