aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index c8e332419c..4aaad6bd2c 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -118,18 +118,31 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
- // Load language file for system locale
- QString locale = QLocale::system().name();
- QTranslator qtTranslator;
- qtTranslator.load(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + locale);
+ // Load language files for system 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;
+
+ qtTranslatorBase.load(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + lang);
+ if (!qtTranslatorBase.isEmpty())
+ app.installTranslator(&qtTranslatorBase);
+
+ qtTranslator.load(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/qt_" + lang_territory);
if (!qtTranslator.isEmpty())
app.installTranslator(&qtTranslator);
- QTranslator translator;
- translator.load(":/translations/"+locale);
+
+ translatorBase.load(":/translations/"+lang);
+ if (!translatorBase.isEmpty())
+ app.installTranslator(&translatorBase);
+
+ translator.load(":/translations/"+lang_territory);
if (!translator.isEmpty())
app.installTranslator(&translator);
- app.setApplicationName(QApplication::translate("main", "Bitcoin Qt"));
+ app.setApplicationName(QApplication::translate("main", "Bitcoin-Qt"));
QSplashScreen splash(QPixmap(":/images/splash"), 0);
splash.show();
@@ -146,7 +159,7 @@ int main(int argc, char *argv[])
{
{
// Put this in a block, so that BitcoinGUI is cleaned up properly before
- // calling Shutdown().
+ // calling Shutdown() in case of exceptions.
BitcoinGUI window;
splash.finish(&window);
OptionsModel optionsModel(pwalletMain);
@@ -157,7 +170,15 @@ int main(int argc, char *argv[])
window.setClientModel(&clientModel);
window.setWalletModel(&walletModel);
- window.show();
+ // If -min option passed, start window minimized.
+ if(GetBoolArg("-min"))
+ {
+ window.showMinimized();
+ }
+ else
+ {
+ window.show();
+ }
app.exec();