|
|
@ -89,10 +89,24 @@ static std::string Translate(const char* psz) |
|
|
|
return QCoreApplication::translate("bitcoin-core", psz).toStdString(); |
|
|
|
return QCoreApplication::translate("bitcoin-core", psz).toStdString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static QString GetLangTerritory() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QSettings settings; |
|
|
|
|
|
|
|
// Get desired locale (e.g. "de_DE")
|
|
|
|
|
|
|
|
// 1) System default language
|
|
|
|
|
|
|
|
QString lang_territory = QLocale::system().name(); |
|
|
|
|
|
|
|
// 2) Language from QSettings
|
|
|
|
|
|
|
|
QString lang_territory_qsettings = settings.value("language", "").toString(); |
|
|
|
|
|
|
|
if(!lang_territory_qsettings.isEmpty()) |
|
|
|
|
|
|
|
lang_territory = lang_territory_qsettings; |
|
|
|
|
|
|
|
// 3) -lang command line argument
|
|
|
|
|
|
|
|
lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString())); |
|
|
|
|
|
|
|
return lang_territory; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Set up translations */ |
|
|
|
/** Set up translations */ |
|
|
|
static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator) |
|
|
|
static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QSettings settings; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove old translators
|
|
|
|
// Remove old translators
|
|
|
|
QApplication::removeTranslator(&qtTranslatorBase); |
|
|
|
QApplication::removeTranslator(&qtTranslatorBase); |
|
|
@ -102,13 +116,7 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans |
|
|
|
|
|
|
|
|
|
|
|
// Get desired locale (e.g. "de_DE")
|
|
|
|
// Get desired locale (e.g. "de_DE")
|
|
|
|
// 1) System default language
|
|
|
|
// 1) System default language
|
|
|
|
QString lang_territory = QLocale::system().name(); |
|
|
|
QString lang_territory = GetLangTerritory(); |
|
|
|
// 2) Language from QSettings
|
|
|
|
|
|
|
|
QString lang_territory_qsettings = settings.value("language", "").toString(); |
|
|
|
|
|
|
|
if(!lang_territory_qsettings.isEmpty()) |
|
|
|
|
|
|
|
lang_territory = lang_territory_qsettings; |
|
|
|
|
|
|
|
// 3) -lang command line argument
|
|
|
|
|
|
|
|
lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Convert to "de" only by truncating "_DE"
|
|
|
|
// Convert to "de" only by truncating "_DE"
|
|
|
|
QString lang = lang_territory; |
|
|
|
QString lang = lang_territory; |
|
|
@ -498,8 +506,6 @@ int main(int argc, char *argv[]) |
|
|
|
Q_INIT_RESOURCE(bitcoin); |
|
|
|
Q_INIT_RESOURCE(bitcoin); |
|
|
|
Q_INIT_RESOURCE(bitcoin_locale); |
|
|
|
Q_INIT_RESOURCE(bitcoin_locale); |
|
|
|
|
|
|
|
|
|
|
|
GUIUtil::SubstituteFonts(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BitcoinApplication app(argc, argv); |
|
|
|
BitcoinApplication app(argc, argv); |
|
|
|
#if QT_VERSION > 0x050100 |
|
|
|
#if QT_VERSION > 0x050100 |
|
|
|
// Generate high-dpi pixmaps
|
|
|
|
// Generate high-dpi pixmaps
|
|
|
@ -521,6 +527,7 @@ int main(int argc, char *argv[]) |
|
|
|
QApplication::setOrganizationName(QAPP_ORG_NAME); |
|
|
|
QApplication::setOrganizationName(QAPP_ORG_NAME); |
|
|
|
QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN); |
|
|
|
QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN); |
|
|
|
QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT); |
|
|
|
QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT); |
|
|
|
|
|
|
|
GUIUtil::SubstituteFonts(GetLangTerritory()); |
|
|
|
|
|
|
|
|
|
|
|
/// 4. Initialization of translations, so that intro dialog is in user's language
|
|
|
|
/// 4. Initialization of translations, so that intro dialog is in user's language
|
|
|
|
// Now that QSettings are accessible, initialize translations
|
|
|
|
// Now that QSettings are accessible, initialize translations
|
|
|
|