Details
-
User Story
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
-
21
-
Foundation Sprint 112, Foundation Sprint 113, Foundation Sprint 114, Foundation Sprint 115, Foundation Sprint 116, Foundation Sprint 117, Foundation Sprint 118, Foundation Sprint 119, Foundation Sprint 120, Foundation Sprint 121
Description
Currently, translations are embedded into the mimetype database itself. Consider switching it to use the Qt translation system (.ts / .qm files).
API / Use cases
Currently, the mimetype database contains various translations that are exposed via QMimeType::comment(). The chosen translation is determined via the default QLocale().
Qt uses QMimeType::comment() itself in file dialogs (e.g. QXdgDesktopPortalFileDialog, and QFileSystemModel(via QAbstractFileIconProviderPrivate::getFileType).
Proposal
Remove the translations from the embedded .xml file, and instead provide them as part of the qtbase translations.
Advantages
Reduction of Qt Core binary size.
The mimetype database to be loaded would be significantly smaller - without translations, the default database size on file system shrinks from 2515 KB to 313 KB. Qt Core binary size is reduced by 5% (from 5.398 KB to 5.105 KB in a release build on Windows).
Consistent translations
Using .ts/.pm files would make the handling of translations consistent with the translations of other parts of the user interfaces, for instance for file-dialogs.
Disadvantages
Behavior change
This would be a behavior change.
Challenges
The freedesktop.xml database currently contains translations for 57 locales. qtbase currently only features translations for 29 locales.
Conversion tool
TODO: extract translations from .xml into .ts file, for instance with Apache xalan or Python's lxml. This could then be run in qttranslations whenever qtbase_xz.ts is updated.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-127004 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
599511,6 | Add Tika mimetypes to qtbase translation system | dev | qt/qttranslations | Status: NEW | -1 | 0 |
579359,6 | WIP: Separate translations for QMimeDatabase | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |
582679,3 | WIP: Add MIME type translations to qtbase translations | dev | qt/qttranslations | Status: ABANDONED | -2 | 0 |
583275,4 | Separate translations from QMimeDatabse and add to qtbase translations | dev | qt/qttranslations | Status: ABANDONED | 0 | 0 |