Browse Source

Merge pull request #859 from laanwj/2012_02_guilanguagearg

Make it possible to set UI language from commandline (implements #678)
0.8
Wladimir J. van der Laan 13 years ago
parent
commit
2d36b60f92
  1. 3
      src/init.cpp
  2. 6
      src/qt/bitcoin.cpp

3
src/init.cpp

@ -197,6 +197,9 @@ bool AppInit2(int argc, char* argv[])
" -connect=<ip> \t\t " + _("Connect only to the specified node") + "\n" + " -connect=<ip> \t\t " + _("Connect only to the specified node") + "\n" +
" -irc \t " + _("Find peers using internet relay chat (default: 0)") + "\n" + " -irc \t " + _("Find peers using internet relay chat (default: 0)") + "\n" +
" -listen \t " + _("Accept connections from outside (default: 1)") + "\n" + " -listen \t " + _("Accept connections from outside (default: 1)") + "\n" +
#ifdef QT_GUI
" -lang=<lang> \t\t " + _("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
#endif
" -dnsseed \t " + _("Find peers using DNS lookup (default: 1)") + "\n" + " -dnsseed \t " + _("Find peers using DNS lookup (default: 1)") + "\n" +
" -banscore=<n> \t " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" + " -banscore=<n> \t " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
" -bantime=<n> \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" + " -bantime=<n> \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") + "\n" +

6
src/qt/bitcoin.cpp

@ -162,11 +162,13 @@ int main(int argc, char *argv[])
ParseParameters(argc, 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 // - First load the translator for the base language, without territory
// - Then load the more specific locale translator // - Then load the more specific locale translator
QString lang_territory = QLocale::system().name(); // "en_US"
QString lang = lang_territory; QString lang = lang_territory;
lang.truncate(lang_territory.lastIndexOf('_')); // "en" lang.truncate(lang_territory.lastIndexOf('_')); // "en"
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator; QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;

Loading…
Cancel
Save