Skip to content

Fix incorrect parsing of translation strings - #1168

Merged
TheOneRing merged 1 commit into
mainfrom
work/linguistincludes
Oct 14, 2026
Merged

TheOneRing merged 1 commit into
mainfrom
work/linguistincludes

Conversation

@fracturehill

@fracturehill fracturehill commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

It seems that lupdate gets confused by some includes that
omit the src/ at the beginning of the path (e.g. in
accountconfiguredsetupwizardstate.cpp), which results in
the ts file output not containing the namespace. This would
then break string lookup at runtime, resulting in the string
not being shown translated to the user.

This commit modifies the woodpecker file containing the lupdate
command to add a "-I src" argument, which adds the src folder as
an extra include path. Also adds a CMake-based test that runs the
same command, but with the -warnings-are-errors argument, which
should help catch any future issues of the same kind.

Fixes #654

@TheOneRing

Copy link
Copy Markdown
Contributor

@fracturehill
fracturehill force-pushed the work/linguistincludes branch from 6de5676 to 747fa4a Compare October 14, 2026 08:44
@fracturehill fracturehill changed the title Fix header includes for Qt Linguist Fix incorrect parsing of translation strings Oct 14, 2026
@fracturehill

Copy link
Copy Markdown
Contributor Author

Urks, we run lupdate without cmake, maybe we should change that? https://github.com/opencloud-eu/desktop/blob/main/.woodpecker/translation.yaml#L21

For future reference: I tried using the canonical CMake-based workflow, and came to the conclusion that it's fundamentally flawed. Since it just scans CMake targets, all files that contain translation strings that were excluded during configuration (e.g. platform-specific files) will not be included in the final .ts file, since they were not added to any target for the local build.

@fracturehill
fracturehill force-pushed the work/linguistincludes branch from 747fa4a to 14fba12 Compare October 14, 2026 08:59
Comment thread test/cmaketests/testtranslations.cmake Resolved
Comment thread test/cmaketests/testtranslations.cmake Resolved
Comment thread test/cmaketests/testtranslations.cmake Resolved
@fracturehill
fracturehill force-pushed the work/linguistincludes branch 3 times, most recently from 81ab6d0 to e691f73 Compare October 14, 2026 14:48
It seems that lupdate gets confused by some includes that
omit the src/ at the beginning of the path (e.g. in
accountconfiguredsetupwizardstate.cpp), which results in
the ts file output not containing the namespace. This would
then break string lookup at runtime, resulting in the string
not being shown translated to the user.

This adds:
- A new CMake script that calls lupdate with an added
"-I src" argument, which adds the src folder as an extra include path.
- A call to that script in the woodpecker file
- A CMake target 'update_translations' that directly runs the script
with the correct output file inside the source tree
- A new test case that runs the script without modifying the
sources, and runs with the -warnings-are-errors switch to
catch future problems like this
@fracturehill
fracturehill force-pushed the work/linguistincludes branch from e691f73 to 76fc5de Compare October 14, 2026 14:54
@TheOneRing

Copy link
Copy Markdown
Contributor

Looks good, let's see what the translation job will do tonight.
🍿

@TheOneRing
TheOneRing merged commit 74cf2b9 into main Oct 14, 2026
@TheOneRing
TheOneRing deleted the work/linguistincludes branch October 14, 2026 15:35
@openclouders openclouders mentioned this pull request Nov 13, 2026
1 task
@saw-jan saw-jan mentioned this pull request Nov 25, 2026
9 of 22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing german translation when sync folder is in use: Invalid local download directory

2 participants