Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33270. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsNo conflicts as of last run. LLM Linter (✨ experimental)Possible typos and grammar issues: +press q to shutdown -> press q to shut down [“shutdown” is a noun; the verb form is “shut down” for the instruction] 2026-02-21 12:41:59 |
a2568c0 to
70dd57e
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
Not sure if this needs a script. Post-freeze changes should be rare enough to just manually take over the affected string without going through any script. |
70dd57e to
291749d
Compare
|
@maflcko, this is for every translation update, after this change previously translated values are kept and recognized by Transifex. @achow101 created a test Bitcoin Core translation sandbox for me where I've uploaded the latest I have generated a dummy French translation and simulated a review on it: Before this PR, changing a single line invalidated 10% of the other translations as well because of the sorting bug described above:
Uploaded the same file that's generated with this PR for #33224 agains a 100% approved language:
And since the translation IDs are resurrected, it correctly shows that a single entry needs to be retranslated:
|
Ah, I see. I wonder if the shasum of the full content can be used as an id for the translation string. Conceptually it seems simpler to get a stable id, than to try to artificially number and re-number the strings, depending on the history. (Obviously this wouldn't help with #33224, but this instance should be trivial to handle manually as a one-off.) |
|
Since we are not using ID-based translations, it seems reasonable to consider removing the |
@hebasto, are suggesting that the bitcoin-test clone where we tried it isn't representative? It did seem to me that we managed to reproduce and fix the instability by stabilizing the ids. But if we're not using the ids, why aren't the translations stable? What alternative do you suggest to stabilize them?
@maflcko we could of course do that, but it would likely invalidate every single text in the next release. We could of course do it step-by-step and only add hashes for the new entries (instead of max-id + 1, as I did in the script here). Note that hashes would prohibit same-text-with-different-translations, e.g. |
We do not use them, but Transifex does.
As I wrote in #33270 (comment):
|
|
Do I understand you correctly that if we remove the IDs, Transifex will identify messages by content instead? Any reason we didn't do that before? |
That’s my guess, though I haven’t tested it.
I’m not aware of any specific reason. |
|
The |
hebasto
left a comment
There was a problem hiding this comment.
stabilize translations...
Concept ACK on this idea.
Could we avoid reintroducing Python scripts into the translate build target?
|
It wouldn't be difficult to make this into a script that generates an id mapping that's we'd run manually, if we're worried about python, something like: sed -E -i \
-e 's|id="_msg1160"|id="_msg1239"|g' \
-e 's|id="_msg1159"|id="_msg1160"|g' \
-e 's|id="_msg120\[0\]"|id="_msg1240\[0\]"|g' \
-e 's|id="_msg120\[1\]"|id="_msg1240\[1\]"|g' \
'src/qt/locale/bitcoin_en.xlf'Would that be more useful in your opinion? What are the worries exactly, can you please point me to the discussion that you were referring to with "reintroducing Python scripts" (or is this just a reference to the cmake migration)? We could of course migrate this to cmake as well, but do we really want to do that :)? I don't... |
The Python dependency for the |
I would do It, but I am concerned about the bus factor, so I would prefer to train someone else. |
|
What is the status of this? |
|
It worked correctly for stabilizing the translations - removals and moves alike. Some reviewers would prefer rewriting the logic from python to cmake, but it should work currently as-is. Reviews and reproducers are welcome. |
|
Ok. I think @hebasto needs to make a call here then. |
In that case, the context should be hashed, too. I presumed that the majority of texts were invalidated anyway, so it shouldn't matter much. But I haven't confirmed this, and maybe I am wrong. |
This PR restores the IDs of all unchanged values so the translators should only see the changed entries. |
I understand, but my point is that there is no value in trying to keep the exact old IDs. Basically, every update invalidates all of them: |
Updated the script to do that: instead of trying to preserve/renumber sequential Let me know what you think of this approach: @maflcko, @hebasto, @fanquake. |
291749d to
a38b8cf
Compare
|
I understand that tomorrow's the translation freeze, but maybe we could finalize the IDs to avoid doing the translation realignment dance in next releases - this change should help with that. |
That's correct.
Right. And this PR needs more review for now. |
a38b8cf to
ab26998
Compare
|
I've collected fresh data during the ongoing release cycle. A new resource "31.x" was created from the pre-PR34525 This leads me to believe that this PR won't solve the issue of transferring the "Reviewed" status. That said, I do recognize its other benefits, such as minimizing difffs. |
|
Thanks for checking. What does the |
Sequential `_msg<N>` IDs shift when strings move in the sorted message list, creating churn and misidentifying unchanged strings on translation platforms. Derive `<trans-unit id>` values as sha256(`resname` + "\0" + source text), preserving plural `[N]` suffixes and aborting on duplicate ids. # Conflicts: # src/qt/locale/bitcoin_en.ts # src/qt/locale/bitcoin_en.xlf
ab26998 to
c5261b5
Compare
I continued observing this during the current release cycle. PR bitcoin-core/gui#931 was merged to reflect changes in translatable strings made between "Soft translation string freeze" and "Translation string freeze". While those changes touched fewer than a dozen strings, the resulting diff modified the IDs for over 400 strings. Consequently, Transifex treated all of those strings as new, automatically fetching translations via Translation Memory and resetting their "Reviewed" status. This PR seems to prevent this annoying behaviour. cc @AO-LocLab |
|
I've reviewed the current Transifex docs regarding their support for the Qt Linguist ( It appears they now support all the features that were unavailable four years ago, which is what originally motivated the switch to XLIFF. Given this, perhaps we should consider switching back to Qt's native translation file format as an alternative to this PR. |
I opened #34808. |
|
Close this for now, if you're Concept ACK for #34808? |
|
Closing in favor of #34808 |
… translations on Transifex a434d66 cmake, translation: Specify English as target language explicitly (Hennadii Stepanov) 4097d6d cmake, translation: Sort messages within contexts alphabetically (Hennadii Stepanov) 312ab8a cmake, translation: Skip source locations in TS files (Hennadii Stepanov) 4f553bd cmake, translation: Remove TS to XLIFF conversion (Hennadii Stepanov) 8c30055 translation: Switch to Qt TS source file (Hennadii Stepanov) Pull request description: In Bitcoin Core v22.0, we [switched](#21694) from Qt TS to XLIFF translation source file to provide more context, specifically [developer notes](https://doc.qt.io/qt-6/i18n-source-translation.html#add-comments-for-translators), to translators on Transifex. That was very useful for translators back then, even though it required some extra complexity on our side. Since then, Transifex has enabled support for developer notes in [Qt TS files](https://help.transifex.com/en/articles/6223301-qt-linguist) as well. Therefore, I believe we should thank XLIFF for its service and retire it. In addition to switching back to Qt TS, this PR introduces a few tweaks to the `lupdate` command (see the corresponding commit messages). To summarize, this PR brings the following benefits: 1. Removal of obsolete code from the build system. 2. Minimal diffs during translation updates. For a recent example, see bitcoin-core/gui#931. One can also apply the changes from #34301 and run `cmake -B build --fresh -DBUILD_GUI=ON && cmake --build build -t translate` to observe the new minimal diff. 3. More stable string hashes on Transifex. They no longer include string `id`s, which makes this PR an alternative to #33270. As a potential drawback, we are tying ourselves back to Qt's proprietary translation file format. I've created an experimental resource on Transifex based on this branch: https://app.transifex.com/bitcoin/bitcoin/experimental-do-not-translate. Reviewers can use it to observe Transifex's support for the various features on the following messages: - \# 11 - Developer Notes - \# 144 - Plurals - \# 510 - A disambiguation string (provided as a second argument to the [`tr()`](https://doc.qt.io/qt-6/qobject.html#tr) function) added to the string context. ACKs for top commit: l0rinc: Code review ACK a434d66 achow101: ACK a434d66 sedited: ACK a434d66 Tree-SHA512: 2f79af707974acd8c955e01c06b41794ae1702964bd5f6d260dba73f2f14d0b4b6e84f502f8515d84585e00db8db5b644cb6c47f91662a7ba5b6990f2d0ba115
…e as source for translations on Transifex a372d85 cmake, translation: Specify English as target language explicitly (Hennadii Stepanov) d4a0b8a cmake, translation: Sort messages within contexts alphabetically (Hennadii Stepanov) 4984044 cmake, translation: Skip source locations in TS files (Hennadii Stepanov) ed51c70 cmake, translation: Remove TS to XLIFF conversion (Hennadii Stepanov) 6c0ff39 translation: Switch to Qt TS source file (Hennadii Stepanov) Pull request description: In Bitcoin Core v22.0, we [switched](bitcoin/bitcoin#21694) from Qt TS to XLIFF translation source file to provide more context, specifically [developer notes](https://doc.qt.io/qt-6/i18n-source-translation.html#add-comments-for-translators), to translators on Transifex. That was very useful for translators back then, even though it required some extra complexity on our side. Since then, Transifex has enabled support for developer notes in [Qt TS files](https://help.transifex.com/en/articles/6223301-qt-linguist) as well. Therefore, I believe we should thank XLIFF for its service and retire it. In addition to switching back to Qt TS, this PR introduces a few tweaks to the `lupdate` command (see the corresponding commit messages). To summarize, this PR brings the following benefits: 1. Removal of obsolete code from the build system. 2. Minimal diffs during translation updates. For a recent example, see bitcoin-core/gui#931. One can also apply the changes from bitcoin/bitcoin#34301 and run `cmake -B build --fresh -DBUILD_GUI=ON && cmake --build build -t translate` to observe the new minimal diff. 3. More stable string hashes on Transifex. They no longer include string `id`s, which makes this PR an alternative to bitcoin/bitcoin#33270. As a potential drawback, we are tying ourselves back to Qt's proprietary translation file format. I've created an experimental resource on Transifex based on this branch: https://app.transifex.com/bitcoin/bitcoin/experimental-do-not-translate. Reviewers can use it to observe Transifex's support for the various features on the following messages: - \# 11 - Developer Notes - \# 144 - Plurals - \# 510 - A disambiguation string (provided as a second argument to the [`tr()`](https://doc.qt.io/qt-6/qobject.html#tr) function) added to the string context. ACKs for top commit: l0rinc: Code review ACK a372d85 achow101: ACK a372d85 sedited: ACK a372d85 Tree-SHA512: 2f79af707974acd8c955e01c06b41794ae1702964bd5f6d260dba73f2f14d0b4b6e84f502f8515d84585e00db8db5b644cb6c47f91662a7ba5b6990f2d0ba115
…e as source for translations on Transifex a434d66025095764cf58c5a049cf4414f53ee52f cmake, translation: Specify English as target language explicitly (Hennadii Stepanov) 4097d6d968e835ac1233efcbc31bb7b776bdb51f cmake, translation: Sort messages within contexts alphabetically (Hennadii Stepanov) 312ab8ab0a8ec70a2af5317dd0fd569c948e82e8 cmake, translation: Skip source locations in TS files (Hennadii Stepanov) 4f553bd0da2568dd3865806dd3274c7f4d1b7399 cmake, translation: Remove TS to XLIFF conversion (Hennadii Stepanov) 8c30055458b49d06f4a92c98bbe30be287898fa0 translation: Switch to Qt TS source file (Hennadii Stepanov) Pull request description: In Bitcoin Core v22.0, we [switched](bitcoin/bitcoin#21694) from Qt TS to XLIFF translation source file to provide more context, specifically [developer notes](https://doc.qt.io/qt-6/i18n-source-translation.html#add-comments-for-translators), to translators on Transifex. That was very useful for translators back then, even though it required some extra complexity on our side. Since then, Transifex has enabled support for developer notes in [Qt TS files](https://help.transifex.com/en/articles/6223301-qt-linguist) as well. Therefore, I believe we should thank XLIFF for its service and retire it. In addition to switching back to Qt TS, this PR introduces a few tweaks to the `lupdate` command (see the corresponding commit messages). To summarize, this PR brings the following benefits: 1. Removal of obsolete code from the build system. 2. Minimal diffs during translation updates. For a recent example, see bitcoin-core/gui#931. One can also apply the changes from bitcoin/bitcoin#34301 and run `cmake -B build --fresh -DBUILD_GUI=ON && cmake --build build -t translate` to observe the new minimal diff. 3. More stable string hashes on Transifex. They no longer include string `id`s, which makes this PR an alternative to bitcoin/bitcoin#33270. As a potential drawback, we are tying ourselves back to Qt's proprietary translation file format. I've created an experimental resource on Transifex based on this branch: https://app.transifex.com/bitcoin/bitcoin/experimental-do-not-translate. Reviewers can use it to observe Transifex's support for the various features on the following messages: - \# 11 - Developer Notes - \# 144 - Plurals - \# 510 - A disambiguation string (provided as a second argument to the [`tr()`](https://doc.qt.io/qt-6/qobject.html#tr) function) added to the string context. ACKs for top commit: l0rinc: Code review ACK a434d66025095764cf58c5a049cf4414f53ee52f achow101: ACK a434d66025095764cf58c5a049cf4414f53ee52f sedited: ACK a434d66025095764cf58c5a049cf4414f53ee52f Tree-SHA512: 2f79af707974acd8c955e01c06b41794ae1702964bd5f6d260dba73f2f14d0b4b6e84f502f8515d84585e00db8db5b644cb6c47f91662a7ba5b6990f2d0ba115







Summary
Regenerating the Qt translation template (
src/qt/locale/bitcoin_en.xlf) previously used sequential_msg<N>IDs. When strings moved within the sorted message list, IDs shifted, creating large diffs and making translation platforms treat unchanged strings as new.This PR switches XLF
<trans-unit id=...>values to stable IDs derived from a SHA256 hash of the message context and source text.Details
As mentioned in #33224 (comment), any change that moves a translatable string within the sorted messages can renumber subsequent entries when IDs are sequential.
Some English texts can appear in multiple places (e.g. “Clear”) with different meanings depending on the Qt context. To avoid collisions, the hash includes the
<group resname=...>context.Fix
The
translatetarget already runscontrib/devtools/stabilize_xlf_ids.py. Instead of trying to preserve/renumber_msg<N>IDs by matching old/new units, the script now rewrites every<trans-unit id>to:sha256(resname + "\0" + source-text)(hex)[N]suffix for plural formsThe script also checks for duplicate IDs and aborts if any are detected.
Note: this is a one-time mass change from
_msg<N>IDs to hashes; after that, rerunningtranslateon an unchanged tree should not churn IDs.With this PR applied, IDs become stable hashes so ordering changes no longer cause renumbering churn.
Reproducer
You can test the replacer by changing any translatable text:
and regenerating the translations
cmake --preset dev-mode -DWITH_USDT=OFF && cmake --build build_dev_mode --target translateYou will notice that the new text moved to a different place with a different hash, but all other messages retained their IDs.