@@ -187,30 +187,31 @@ int main(int argc, char *argv[])
187
187
// ... then GUI settings:
188
188
OptionsModel optionsModel;
189
189
190
- // Get desired locale ("en_US ") from command line or system locale
190
+ // Get desired locale (e.g. "de_DE ") from command line or use system locale
191
191
QString lang_territory = QString::fromStdString (GetArg (" -lang" , QLocale::system ().name ().toStdString ()));
192
- // Load language files for configured locale:
193
- // - First load the translator for the base language, without territory
194
- // - Then load the more specific locale translator
195
192
QString lang = lang_territory;
193
+ // Convert to "de" only by truncating "_DE"
194
+ lang.truncate (lang_territory.lastIndexOf (' _' ));
196
195
197
- lang.truncate (lang_territory.lastIndexOf (' _' )); // "en"
198
196
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
197
+ // Load language files for configured locale:
198
+ // - First load the translator for the base language, without territory
199
+ // - Then load the more specific locale translator
199
200
200
- qtTranslatorBase. load ( QLibraryInfo::location (QLibraryInfo::TranslationsPath) + " /qt_ " + lang);
201
- if (! qtTranslatorBase.isEmpty ( ))
201
+ // Load e.g. qt_de.qm
202
+ if (qtTranslatorBase.load ( " qt_ " + lang, QLibraryInfo::location (QLibraryInfo::TranslationsPath) ))
202
203
app.installTranslator (&qtTranslatorBase);
203
204
204
- qtTranslator. load ( QLibraryInfo::location (QLibraryInfo::TranslationsPath) + " /qt_ " + lang_territory);
205
- if (! qtTranslator.isEmpty ( ))
205
+ // Load e.g. qt_de_DE.qm
206
+ if (qtTranslator.load ( " qt_ " + lang_territory, QLibraryInfo::location (QLibraryInfo::TranslationsPath) ))
206
207
app.installTranslator (&qtTranslator);
207
208
208
- translatorBase. load ( " :/translations/ " +lang);
209
- if (! translatorBase.isEmpty ( ))
209
+ // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
210
+ if (translatorBase.load (lang, " :/translations/ " ))
210
211
app.installTranslator (&translatorBase);
211
212
212
- translator. load ( " :/translations/ " +lang_territory);
213
- if (! translator.isEmpty ( ))
213
+ // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
214
+ if (translator.load (lang_territory, " :/translations/ " ))
214
215
app.installTranslator (&translator);
215
216
216
217
QSplashScreen splash (QPixmap (" :/images/splash" ), 0 );
0 commit comments