Overhaul translation deployment - #221
Open
meator wants to merge 5 commits into
Open
Conversation
Removed old broken qt_*.qm handling, added a smarter new one utilizing lconvert when needed and made everything configurable.
meator
force-pushed
the
pr/qt-translations
branch
2 times, most recently
from
August 23, 2026 19:03
fd56852 to
db238ae
Compare
meator
force-pushed
the
pr/qt-translations
branch
from
August 24, 2026 06:14
db238ae to
c824300
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As promissed, I fixed linuxdeploy-plugin-qt's translation handling.
I've had to delve into the code a bit deeper to implement these changes. I have some remarks (none of them are particularly important):
Taywee/args lacks useful features, especially with the flags I added. I'm missing proper support for
--feature/--no-featureflag combos and defaulting to env variables. The competition, like CLI11, offers these basic features.If you agree, I can make switching to CLI11 or some other argument parser a part of this PR.
Why is
deployment.hso chunky? Header files shouldn't contain so much code.The following code:
linuxdeploy-plugin-qt/src/deployment.h
Lines 132 to 133 in 9b9fca1
does not make sense, a
qt_.qmfile has at least 8 characters. I assumed it is broken and removed it in favor of my newqt_*.qmgeneration.The dependency situation isn't ideal. There's some git submodule vendoring, some old CMake FetchContent fetching straight from git with full history...
The build system also calls git directly, which is a build system smell. Repos might be built from release archives, but git submodules complicate this task. Well behaved projects either avoid git submodules or provide a separate source release artifact with all submodules and vendored things included.
I'm a huge advocate for the Meson build system. Its wrap mechanism solves all these issues and more. But if my understanding is correct, one of the aims of linuxdeploy-plugin-qt's build system is compatibility with older distros, which makes the situation more understandable.
This is not a call for action, I do not expect a fix for this since for example the old distro compatibility can be restrictive.
I can contribute a
.clang-formatfile if there's interest.Not having to worry about formatting is nice. If there's interest, I'll try to find out which clang format configuration options reflect the current code style best.
If you agree with this, it would make most sense to add it to other linuxdeploy repos too.
While we're talking about code formatting, what is this!?
The fact that all of this can be converted into a single line doesn't help, but I've noticed this pattern in other places too. AppImage devs must have wide monitors.
What is this project's stance on exceptions?
I know this is a controversial topic. I've added a few, but I tried to not get overboard. If you don't like it, I can rework the code to not use exceptions.
Now about the translation deployment:
Since I wrote my comments in #194, I researched this a bit further and have changed my opinion on some of the things. For example, I didn't see a reason for symlinking user translations to
usr/translations, but I have since learned that this behavior is reasonable and similar to that ofwindeployqtand (I think, haven't tested)macdeployqt.The changes and documentation in this PR should be the autoritative source of how I think these things should work.
I've done most of my testing on Qt6 and some late Qt5. If this code has been written with older Qt in mind (older Qt5, Qt4 or something else), some of my assumptions might not be correct. Perhaps some of linuxdeploy-plugin-qt's stranger choices could be explained by older Qt.
I've written a program to test these changes and to help me during developing: sample_tr_program.gitbundle.gz
(a gziped git bundle)
The program implements several methods of looking up translations. These methods are fully configurable at configure time and can be used to "emulate" the behavior of other programs. For example, if you want
sample_tr_programto be a program which installs its translations to<prefix>/usr/share/sample_tr_program/i18nand stubbornly expects to find them in the exact same location where it installed them (this is a naïve behavior of some programs I saw which is incompatible with Windows/Mac/AppImage deployment), one can configure it withand installed with
The program can use several app translations loading strategies at once (as I recommend in the developer README documentation I added). They can be controlled with
app_translation_lookup_dir_1,app_translation_lookup_dir_2... It is an ordered list, once the translation is found, no further methods are used.The program provides detailed output on translation loading in stderr logs, with popup windows and with the GUI program itself.
The program pulls in a single translation prefix. This bypasses the
lconvertlogic I added (there's no need to merge translations when there is only one per language). To add more, dependencies can be artificially injected. For example, the following diff injects QtMultimedia dependency:I've consulted my distro's package repository for reasonable locations of installed
.qmapplication translations and my own best judgement for the methods of looking them up. See themeson_options.txtfile (I haven't documented it that thoroughly, it is a test utility).I've added extensive documentation on translations. It is an user facing documentation though, it doesn't explain linuxdeploy-plugin-qt translation deploying logic.
Also note that the
--qt-languagesflag I added only affects Qt translations, not user ones. This should be consistent withwindeployqt(haven't tested though). This may be counterintuitive, I'm willing to discuss this further.If you've got better names for the flags and env variables, please share feedback. These are the kinds of things that are hard to change retroactively.
fixes #194