[Translations] Correctly load translation for non-translated countries

Closes #1152
remotes/origin/falkon
nowrep 12 years ago
parent fc7b289be2
commit bcaecbdde1
  1. 13
      src/lib/app/mainapplication.cpp

@ -762,6 +762,19 @@ void MainApplication::translateApp()
file.append(".qm");
}
// If "xx_yy" translation doesn't exists, try to use "xx*" translation
// It can only happen when Language is chosen from system locale
if (!file.isEmpty() && !QFile(TRANSLATIONSDIR + QLatin1String("/") + file).exists()) {
QDir translationsDir(TRANSLATIONSDIR);
QString lang = file.left(2) + QLatin1String("*.qm");
const QStringList translations = translationsDir.entryList(QStringList(lang));
// If no translation can be found, default English will be used
file = translations.isEmpty() ? QString() : translations.first();
}
QTranslator* app = new QTranslator(this);
app->load(file, TRANSLATIONSDIR);

Loading…
Cancel
Save