Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.2
-
None
-
-
d52c7a886 (dev), 22f3c6ac5 (6.7), 51a08cc79 (6.6), 8a2d08562 (tqtc/lts-6.5), 666e7ad35 (dev), 4659b576a (6.7), 3f34ef350 (6.6), 0af897ccb (tqtc/lts-6.5), d39e9f21c (dev), 98d822d1b (6.7)
Description
Steps to reproduce:
- Create a simple C++ GUI application with a single UI file
- Ensure the UI file has the `idbasedtr="true"` attribute and is fully ID-based
- Ensure the C++ uses `qtTrId` consistently
- set `CMAKE_AUTOUIC_OPTIONS` to `-idbased` in `CMakeLists.txt`
- Call `qt_add_translations` on the application target
- Without specifying `SOURCES` manually
- With `LRELEASE_OPTIONS -idbased`
- Build the application
- Run `update_translations`
This will produce a `.ts` file that contains translations with a context with an empty name, and which have the identifier as the source text, despite that the `ui_*.h` files use `qtTrId`, which should mark them as ID-based anyway. These duplicate the (correct) entries generated from the `.ui` files themselves.
I tried to avoid this in a couple ways besides specifying SOURCES manually, but none of them worked:
- Passing an extensions list that excluded .h files
- Using clang via a compilation database, with a build dir outside the source dir, and passing `-project-roots` to exclude it
This is because CMake generates a project JSON file that explicitly lists the generated headers, and that overrides both of these mechanisms as far as I can tell.
This seems to be a confluence of no less than three suboptimal behaviors:
- `uic` fails to propagate the source text and comment fields to the header
- `lupdate` fails to properly treat `qtTrId` in such headers (lacking a `//%` comment) as being ID-based
- Despite `lupdate` supporting UI files directly, it's still passed the generated `ui_*.h` files as well
(apologies for the mangled early submission, was fighting with the rich text editor)
Attachments
Issue Links
- relates to
-
QTBUG-43540 Qt Linguist doesn't use context information provided by id-based translations
-
- Reported
-
- resulted in
-
QTBUG-123995 CMake error "Too many parentheses." on qt_add_lupdate
-
- Closed
-