aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-02-17 18:44:39 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2012-02-17 18:47:31 +0100
commit72075edafb62ebff58063af123d3c8bf1370f0e2 (patch)
treee3bce2c3258a8b3b5c42cdca2a90bc8172450ae2 /src/qt
parenta3f3e54eee7f9d354d2f48394ddc2130450968a7 (diff)
Allow setting UI language from commandline (implements #678)
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 8c4b0e6c10..20c185ed27 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -162,11 +162,13 @@ int main(int argc, char *argv[])
ParseParameters(argc, argv);
- // Load language files for system locale:
+ // Get desired locale ("en_US") from command line or system locale
+ QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString()));
+ // Load language files for configured locale:
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator
- QString lang_territory = QLocale::system().name(); // "en_US"
QString lang = lang_territory;
+
lang.truncate(lang_territory.lastIndexOf('_')); // "en"
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;