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 <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2025-01-16 14:35:17 +01:00
parent bc733ea787
commit 9574e8cbef

View File

@ -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