summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-03-28 15:59:13 +0100
committerkrzys-h <krzys_h@interia.pl>2013-03-28 15:59:13 +0100
commitb284fd74f32d31fa287e1e62800c122c2d1efd9d (patch)
tree102b7a5c2832c255f89b9264924cb4db02763c06
parent8659fb984f4fe5495d5a3ddbeeb7bd592f0c4a4c (diff)
downloadcolobot-b284fd74f32d31fa287e1e62800c122c2d1efd9d.tar.gz
colobot-b284fd74f32d31fa287e1e62800c122c2d1efd9d.tar.bz2
colobot-b284fd74f32d31fa287e1e62800c122c2d1efd9d.zip
Changes to fix multilanguage on Windows
Issue #118
-rw-r--r--src/app/app.cpp12
-rw-r--r--src/app/app.h3
2 files changed, 14 insertions, 1 deletions
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