From 9574e8cbef06b3b55d1f651b09d134aef7150aba Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 16 Jan 2025 14:35:17 +0100 Subject: [PATCH] QMimeType::comments(): skip locale-name-trimming Pruning the part of a locale name after the first '_' should now be redundant, as QLocale::uiLanguages() now includes the resulting truncations. It may do so later in the sequence than the pruning used here, where the pruned version either might be a bad choice (due to being in a script incompatible with what we started on, e.g. pruning pa_PK to pa, which uses a different script) or would also arise from some later, more specific, entry (as when uiLanguages() is expanded from {en_NL, en_150}, where checking en immediately after en_NL would bypass the more specific en_150 when present). Pick-to: 6.9 Change-Id: I4c7c199ca16a8e4803843547c5a689cea11af1f2 Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimetype.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 31622a21e73..2c23f3175db 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -213,13 +213,6 @@ QString QMimeType::comment() const QString comm = localeComments.value(lang); if (!comm.isEmpty()) return comm; - const qsizetype cut = lang.indexOf(u'_'); - // If "de_CH" is missing, check for "de" (and similar): - if (cut != -1) { - comm = localeComments.value(lang.left(cut)); - if (!comm.isEmpty()) - return comm; - } } // Use the mimetype name as fallback