quassel
quassel copied to clipboard
common: Fix translation loading, use all paths
In short
- Fix
QTranslator
loading Qt translations on Linux- Specify directory as
directory
inload()
, not asprefix
- Fixes loading Qt (not Quassel) translations on Ubuntu 20.04 LTS
- Specify directory as
- Load translations from all available translation data directories
- Fixes failure to load translations on Windows due to Qt translation install path
- Always includes internal resource when present (
:/i18n/
)
Criteria | Rank | Reason |
---|---|---|
Impact | ★★★ 3/3 | Fixes missing translations on Windows |
Risk | ★★☆ 2/3 | Modifies translation search/load code, macOS untested |
Intrusiveness | ★☆☆ 1/3 | Small set of changes, shouldn't interfere with other pull requests |
Details
As of 0.14.0, the Windows installer for Quassel places the Qt translations into C:\Program Files\Quassel IRC\translations
folder, while Quassel's own translations are bundled internally in :/i18n/
.
Before this change, Quassel would only try to load translations from one possible data path, missing the bundled translations in :/i18n/
.
After this change, Quassel tries to load translations from all available data paths, including the bundled translations when present.
Testing
Steps
- Build and install Quassel
- On Windows, download the
Windows.zip
artifact from GitHub Actions
- On Windows, download the
- Open the configuration window
- Go to
Settings
→Configure Quassel…
- Or, press F7
- Go to
- Expand the
Language:
drop-down, check that expected languages are present - Select a different language, apply
- Restart Quassel
- Check if the language applied successfully
Before
Linux
Qt translations fail to load according to the false
return status of qtTranslator->load(…)
with QLibraryInfo::location(QLibraryInfo::TranslationsPath)
.
Windows
All translations fail to load.
The Language:
setting in the configuration window displays <Untranslated>
, <System Default>
, and C
as the only options.
After
Linux
Qt translations successfully load according to the true
return status of qtTranslator->load(…)
with QLibraryInfo::location(QLibraryInfo::TranslationsPath)
.
NOTE: For unknown reasons, even when Qt claims the translation loaded successfully, system strings (e.g. the Cancel
button) does not get translated. Quassel's strings change successfully. This is not a regression as the same issue happens on the master
branch.
Windows
Translations load and apply to both Quassel's strings and Qt's system strings (e.g. the Cancel
button).
The Language:
setting in the configuration window displays all the expected language options.
The Debug Log
window now prints the following debug message:
Translation paths: "C:/Program Files/Quassel IRC\translations/", ":/i18n/", with Qt fallback: "C:/Program Files/Quassel IRC/translations"