Fix language selection box

When Qt Creator is installed in a path with underscore.

Amends 451d02c88d

which changed the pattern matching from file name only to the whole
path.

Fixes: QTCREATORBUG-28591
Change-Id: Ice6a7cb34fd2bb98c384a3b7cb573614bb7a43b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Eike Ziller
2022-12-14 14:53:52 +01:00
parent 5cb1a29af2
commit fdad6496f4

View File

@@ -163,10 +163,10 @@ void GeneralSettingsWidget::fillLanguageBox() const
QStringList(QLatin1String("qtcreator*.qm")));
for (const FilePath &languageFile : languageFiles) {
const QString path = languageFile.path();
int start = path.indexOf('_') + 1;
int end = path.lastIndexOf('.');
const QString locale = path.mid(start, end-start);
const QString name = languageFile.fileName();
int start = name.indexOf('_') + 1;
int end = name.lastIndexOf('.');
const QString locale = name.mid(start, end - start);
// no need to show a language that creator will not load anyway
if (hasQmFilesForLocale(locale, creatorTrPath.toString())) {
QLocale tmpLocale(locale);