From 8f251ac16f72e2d56c66748cafce77823ea5a7dd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Nov 2011 00:53:30 +0300 Subject: Add option to settings for select any supported language. (tab Theme) --- src/client.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/client.cpp') 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/")); -- cgit v1.2.3-60-g2f50