summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qlocale_unix.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp
index 346d624f7b..4eaefe0e72 100644
--- a/src/corelib/text/qlocale_unix.cpp
+++ b/src/corelib/text/qlocale_unix.cpp
@@ -113,7 +113,7 @@ Q_GLOBAL_STATIC(QSystemLocaleData, qSystemLocaleData)
#ifndef QT_NO_SYSTEMLOCALE
-static bool contradicts(const QString &maybe, const QString &known)
+static bool contradicts(QStringView maybe, const QString &known)
{
if (maybe.isEmpty())
return false;
@@ -149,11 +149,10 @@ QLocale QSystemLocale::fallbackLocale() const
// ... otherwise, if the first part of LANGUAGE says more than or
// contradicts what we have, use that:
- QString language = qEnvironmentVariable("LANGUAGE");
- if (!language.isEmpty()) {
- language = language.split(QLatin1Char(':')).constFirst();
+ for (const auto &language : qEnvironmentVariable("LANGUAGE").tokenize(QLatin1Char(':'))) {
if (contradicts(language, lang))
return QLocale(language);
+ break; // We only look at the first entry.
}
return QLocale(lang);