From b284fd74f32d31fa287e1e62800c122c2d1efd9d Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 28 Mar 2013 15:59:13 +0100 Subject: Changes to fix multilanguage on Windows Issue #118 --- src/app/app.cpp | 12 +++++++++++- src/app/app.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/app.cpp b/src/app/app.cpp index 9349cbf..d6a697a 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -144,6 +144,7 @@ CApplication::CApplication() m_trackedKeys = 0; m_dataPath = COLOBOT_DEFAULT_DATADIR; + m_langPath = COLOBOT_I18N_DIR; m_language = LANGUAGE_ENV; @@ -213,6 +214,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) OPT_DATADIR, OPT_LOGLEVEL, OPT_LANGUAGE, + OPT_LANGDIR, OPT_VBO }; @@ -223,6 +225,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) { "datadir", required_argument, nullptr, OPT_DATADIR }, { "loglevel", required_argument, nullptr, OPT_LOGLEVEL }, { "language", required_argument, nullptr, OPT_LANGUAGE }, + { "langdir", required_argument, nullptr, OPT_LANGDIR }, { "vbo", required_argument, nullptr, OPT_VBO } }; @@ -258,6 +261,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) GetLogger()->Message(" -datadir path set custom data directory path\n"); GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n"); GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl)\n"); + GetLogger()->Message(" -langdir path set custom language directory path\n"); GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n"); return PARSE_ARGS_HELP; } @@ -298,6 +302,12 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) m_language = language; break; } + case OPT_LANGDIR: + { + m_langPath = optarg; + GetLogger()->Info("Using custom language dir: '%s'\n", m_langPath.c_str()); + break; + } case OPT_VBO: { std::string vbo; @@ -1645,7 +1655,7 @@ void CApplication::SetLanguage(Language language) } setlocale(LC_ALL, ""); - bindtextdomain("colobot", COLOBOT_I18N_DIR); + bindtextdomain("colobot", m_langPath.c_str()); bind_textdomain_codeset("colobot", "UTF-8"); textdomain("colobot"); diff --git a/src/app/app.h b/src/app/app.h index d2561e7..dcc90e0 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -455,6 +455,9 @@ protected: //! Path to directory with data files std::string m_dataPath; + //! Path to directory with language files + std::string m_langPath; + const char* m_dataDirs[DIR_MAX]; //! Application language -- cgit v1.2.3-1-g7c22