Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.9
-
None
-
-
5
Description
QMimeTypePrivate::localeComment() contains the astute observation:
maybe we want to merge in comments from more global providers, in
case of more translations?
to which I find the answer is "definitely, yes."
This is the middle step in a double traversal: its caller, QMimeType::comment(), has a list of locales to traverse, while localeComment() has a list of providers to traverse. Each provider effectively provides this double traversal with a double-mapping: a mapping from MIME type name to (a struct with a member that give us) a mapping from locale names to localised full names for that MIME type. What we want is a localised full name of the MIME type for the earliest entry in the locale list for which some provider offers such a name.
What we actually do at present is get, from QMimeTypePrivate::localeComment(), the mapping from locales to full names from the first provider that has anything for the given MIME type. Later providers may cover more locales for that MIME type, not covered by this first, but we do not consult them. If the first does not have a translation for some full name, but some later provider does, we'll only see the first's lack, not what the later provider offers. As a result, we may end up falling back to a later entry in the locale-name list or even falling off the end of that list and resorting to using the untranslated name, despite the presence of perfectly good translations, from other providers, for a locale early in the locale list.
I propose that we change QMimeTypePrivate::localeComment() to take a language name (or the special key "default") and return the full name in that language for the MIME type named by the first parameter. (Renaming that first parameter from name to mimetype would also be a good idea, to tell the reader what we're doing.) It can return a null QString on failure.
This would let the caller, QMimeType::comment(), ask for the "default" entry, do its new (post-Tika; see QTBUG-127004) translation attempt and then, on failure, iterate the QLocale::uiLanguages() list with calls to localeComment() for each entry in the language list, always getting the name from the first provider to provide one for the given language even if an earlier provider provides data for other languages.
Attachments
Issue Links
- relates to
-
QTBUG-133916 Expand MIME type support
-
- Open
-
-
QTBUG-127004 Separate translations for QMimeTypeDatabase
-
- Closed
-
Gerrit Reviews
For Gerrit Dashboard: QTBUG-132895 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
618397,2 | WIP: Standard dialogs example: Use mime types for file dialogs | dev | qt/qtbase | Status: NEW | -2 | 0 |