mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[Translations] Correctly load translation for non-translated countries
Closes #1152
This commit is contained in:
parent
fc7b289be2
commit
bcaecbdde1
@ -762,6 +762,19 @@ void MainApplication::translateApp()
|
|||||||
file.append(".qm");
|
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);
|
QTranslator* app = new QTranslator(this);
|
||||||
app->load(file, TRANSLATIONSDIR);
|
app->load(file, TRANSLATIONSDIR);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user