diff --git a/src/modules/locale/LocaleConfiguration.cpp b/src/modules/locale/LocaleConfiguration.cpp index da8d4d0f3..f1810fb83 100644 --- a/src/modules/locale/LocaleConfiguration.cpp +++ b/src/modules/locale/LocaleConfiguration.cpp @@ -18,7 +18,11 @@ */ #include "LocaleConfiguration.h" + +#include "utils/Logger.h" + #include +#include LocaleConfiguration::LocaleConfiguration() : explicit_lang( false ) @@ -53,14 +57,9 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale, { QString language = languageLocale.split( '_' ).first(); - QStringList linesForLanguage; - for ( const QString& line : availableLocales ) - { - if ( line.startsWith( language ) ) - { - linesForLanguage.append( line ); - } - } + // Either an exact match, or the whole language part matches + // (followed by . or _ + QStringList linesForLanguage = availableLocales.filter( QRegularExpression( language + "[._]" ) ); QString lang; if ( linesForLanguage.length() == 0 || languageLocale.isEmpty() )