summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-04 00:53:30 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-04 02:28:31 +0300
commit8f251ac16f72e2d56c66748cafce77823ea5a7dd (patch)
treee4196d6a71b284a0a6c0c871cbeb709c89bb3963 /src/client.cpp
parentf21e729bf1ce78449a23ce257f7287e1ead3e4c4 (diff)
downloadplus-8f251ac16f72e2d56c66748cafce77823ea5a7dd.tar.gz
plus-8f251ac16f72e2d56c66748cafce77823ea5a7dd.tar.bz2
plus-8f251ac16f72e2d56c66748cafce77823ea5a7dd.tar.xz
plus-8f251ac16f72e2d56c66748cafce77823ea5a7dd.zip
Add option to settings for select any supported language. (tab Theme)
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
index c90d1886f..262c63d4a 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -286,6 +286,27 @@ Client::Client(const Options &options):
storeSafeParameters();
+#if ENABLE_NLS
+ std::string lang = config.getValue("lang", "");
+#ifdef WIN32
+ putenv((char*)("LANG=" + lang).c_str());
+ putenv((char*)("LANGUAGE=" + lang).c_str());
+ // mingw doesn't like LOCALEDIR to be defined for some reason
+ if (lang != "C")
+ bindtextdomain("manaplus", "translations/");
+#else
+#ifdef ENABLE_PORTABLE
+ bindtextdomain("manaplus", (std::string(PHYSFS_getBaseDir())
+ + "../locale/").c_str());
+#else
+ bindtextdomain("manaplus", LOCALEDIR);
+#endif
+#endif
+ setlocale(LC_MESSAGES, lang.c_str());
+ bind_textdomain_codeset("manaplus", "UTF-8");
+ textdomain("manaplus");
+#endif
+
chatLogger = new ChatLogger;
if (mOptions.chatLogDir == "")
chatLogger->setLogDir(mLocalDataDir + std::string("/logs/"));