Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Use XLIFF file to provide more context to Transifex translators #21694

Merged
merged 4 commits into from
Apr 20, 2021

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Apr 15, 2021

Currently, only a class name is provided to the Transifex translators as a context. Neither disambiguation parameter of the tr() function nor translator comments, being included as XML elements to *.ts translation files, are not parsed by the Transifex due to its limited support of such files.

This PR makes possible to provide all of the context details via an intermediate XLIFF translation file.

With this PR make -C src translate produces the src/qt/locale/bitcoin_en.xlf file which must be provided to the Transifex as a translation source instead of src/qt/locale/bitcoin_en.ts.

Closes #21465.

An example translatable string with additional <context> and <note> XML elements:

<trans-unit id="_msg24">
<source xml:space="preserve">There was an error trying to save the address list to %1. Please try again.</source>
<target xml:space="preserve"></target>
<context-group purpose="location"><context context-type="linenumber">313</context></context-group>
<context-group><context context-type="x-gettext-msgctxt">An error message.</context></context-group>
<note annotates="source" from="developer">%1 is a name of the file (e.g., &quot;addrbook.csv&quot;) that the bitcoin addresses were exported to.</note>
</trans-unit>

@hebasto
Copy link
Member Author

hebasto commented Apr 15, 2021

Hoping on "22.0" milestone assigned to this PR :)

.gitignore Outdated Show resolved Hide resolved
@laanwj laanwj added this to the 22.0 milestone Apr 15, 2021
@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member Author

hebasto commented Apr 17, 2021

CI is green now :)

@DrahtBot
Copy link
Contributor

Gitian builds

File commit 0dd7b23
(master)
commit b261625
(master and this pull)
*-aarch64-linux-gnu-debug.tar.gz ab2c23caf86b0a85... b08da43780b99555...
*-aarch64-linux-gnu.tar.gz 5cebfcc46be023c4... c2c318bcec80ce0f...
*-arm-linux-gnueabihf-debug.tar.gz 90b0b16aca876b32... 49cf4422bf117438...
*-arm-linux-gnueabihf.tar.gz c750e63cb56b0b30... 84c797c443a77dd9...
*-osx-unsigned.dmg 02781d5d06b770f5... 3f7675b5da92332b...
*-osx64.tar.gz 4c14b91de03fcaf0... 61034d964cbe792b...
*-powerpc64-linux-gnu-debug.tar.gz 3563031ad26a97e4... eee76db985211b3e...
*-powerpc64-linux-gnu.tar.gz dce70d000932486f... caf60d166e480915...
*-powerpc64le-linux-gnu-debug.tar.gz b03d67f0294c1482... 6e7f3702a421abef...
*-powerpc64le-linux-gnu.tar.gz 5d2d82da598bb2bf... 6652af1c943f71fa...
*-riscv64-linux-gnu-debug.tar.gz c6d9818eb544f339... 6035078613b86297...
*-riscv64-linux-gnu.tar.gz 0c73d8281fe6c534... 64b71b7162c9984f...
*-win64-debug.zip 124c7f0b29775e81... 790abaa4656f5fe1...
*-win64-setup-unsigned.exe 1d3ac5fa8b7ec7e3... 17e21d7671569bf7...
*-win64.zip 1543663462236fae... de84b0dfdad83874...
*-x86_64-linux-gnu-debug.tar.gz 4374826a7b13fc85... 5a735298af630f37...
*-x86_64-linux-gnu.tar.gz 3abc445e53056b3a... 7dd5b5d6b870c6d9...
*.tar.gz 30f6495725fc36fd... 4dfa41af16ef4b29...
bitcoin-core-linux-22-res.yml 5face52e7d5d59ea... 88aef4e09a1bf4f1...
bitcoin-core-osx-22-res.yml 1fdb209e797b9a0d... f9bc96c8f199a237...
bitcoin-core-win-22-res.yml f67f2e971d911c9a... 3ff23c3ac45fa717...
linux-build.log dcd229b621775505... 86f606eb55a769e7...
osx-build.log 7574d2f4e5054181... 1506a6704ab04d91...
win-build.log 00f2ffeb88433a49... 9a240638a66e679d...
bitcoin-core-linux-22-res.yml.diff eeb3fc3f007b475b...
bitcoin-core-osx-22-res.yml.diff 11e25cd3c2b0640c...
bitcoin-core-win-22-res.yml.diff 685344d175a3203b...
linux-build.log.diff 2ac2e70fd3b7e974...
osx-build.log.diff 02916cfc86be2925...
win-build.log.diff 7dfc3d3072dd5ec3...

@hebasto
Copy link
Member Author

hebasto commented Apr 19, 2021

Guix builds:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
4aacdb5fc0138a0587939be1f9c47bbd90e8d5f58d26ff632b3d3e0eab56a323  guix-build-347a45d40c0d/output/aarch64-linux-gnu/bitcoin-347a45d40c0d-aarch64-linux-gnu-debug.tar.gz
32ba44b565442555f61bbcadef67f9321ad62937be802459aed1e89ada0b54eb  guix-build-347a45d40c0d/output/aarch64-linux-gnu/bitcoin-347a45d40c0d-aarch64-linux-gnu.tar.gz
874df98fa3e5cfc1b9be6b1838c7bb35496652e7d000d65fa313a92fca459174  guix-build-347a45d40c0d/output/arm-linux-gnueabihf/bitcoin-347a45d40c0d-arm-linux-gnueabihf-debug.tar.gz
2958150120f71dfe7f8f342e5d5fda8adb50467f01e22b0587f7b16a91de125c  guix-build-347a45d40c0d/output/arm-linux-gnueabihf/bitcoin-347a45d40c0d-arm-linux-gnueabihf.tar.gz
87646c550c3b32df071464f608c86b468edb2b227321147fc1085c9dda17f518  guix-build-347a45d40c0d/output/dist-archive/bitcoin-347a45d40c0d.tar.gz
04da2a653141d61501b19596f96240abee2f89367e730cc3bcf201bb61975cff  guix-build-347a45d40c0d/output/powerpc64-linux-gnu/bitcoin-347a45d40c0d-powerpc64-linux-gnu-debug.tar.gz
c8948317ee27408c7e7817c075b0559419990f1ecc06d8c88829cfd67034c048  guix-build-347a45d40c0d/output/powerpc64-linux-gnu/bitcoin-347a45d40c0d-powerpc64-linux-gnu.tar.gz
f0e4a519299e72a7d2feee069a709d5dda4dbbb669ea84b131a1d2b479963d30  guix-build-347a45d40c0d/output/powerpc64le-linux-gnu/bitcoin-347a45d40c0d-powerpc64le-linux-gnu-debug.tar.gz
f9db97a01e7b153882b5ca8b89ae51862424414c7645f1f1413b1f9d6fa0fcad  guix-build-347a45d40c0d/output/powerpc64le-linux-gnu/bitcoin-347a45d40c0d-powerpc64le-linux-gnu.tar.gz
a7c99c2045c5a12277a49c1aa08a5fd8f55252f2db9661d364c1b41e0afd8c12  guix-build-347a45d40c0d/output/riscv64-linux-gnu/bitcoin-347a45d40c0d-riscv64-linux-gnu-debug.tar.gz
25d35e70ceeccd5ae3a1d1ab389b27192e6ebe217d5960f2e9a622787a5bf762  guix-build-347a45d40c0d/output/riscv64-linux-gnu/bitcoin-347a45d40c0d-riscv64-linux-gnu.tar.gz
5b2483d05f4fd393cf6ed5882001fc420dcf1add27200c171059dd2bb8ec2a27  guix-build-347a45d40c0d/output/x86_64-apple-darwin18/bitcoin-347a45d40c0d-osx-unsigned.dmg
534c838a6112ac87f9288aea585cf05f5a5450b58de74a4ad9388a14a4b56019  guix-build-347a45d40c0d/output/x86_64-apple-darwin18/bitcoin-347a45d40c0d-osx-unsigned.tar.gz
2506ffbc585f637d3b0587f9cee737e15df83bdaaca1d8f2373dcf21f55179cc  guix-build-347a45d40c0d/output/x86_64-apple-darwin18/bitcoin-347a45d40c0d-osx64.tar.gz
5d773c27ae724623a9a14538bddc23acbec9df49bef61306c943ba4c561fc70e  guix-build-347a45d40c0d/output/x86_64-linux-gnu/bitcoin-347a45d40c0d-x86_64-linux-gnu-debug.tar.gz
bc83d9f50b2d6d7c9dfc190cf62b22e1e6b152718edb2392e4f03b64e2fd01ac  guix-build-347a45d40c0d/output/x86_64-linux-gnu/bitcoin-347a45d40c0d-x86_64-linux-gnu.tar.gz
5048bc3cedb9454967213a7d9298672f0fc35ebe2097cbd21312d533542b8f9c  guix-build-347a45d40c0d/output/x86_64-w64-mingw32/bitcoin-347a45d40c0d-win-unsigned.tar.gz
414ce9df468cc0668e63f8ef6e2277f93481bb068423bb0ba073b713d455aa67  guix-build-347a45d40c0d/output/x86_64-w64-mingw32/bitcoin-347a45d40c0d-win64-debug.zip
bc364ddd8445d01fcc98759c8233a6243c0216505e68260d4316ce3d8be346e7  guix-build-347a45d40c0d/output/x86_64-w64-mingw32/bitcoin-347a45d40c0d-win64-setup-unsigned.exe
25b1f4390d2d937e38f1b44f6238202ddb6403b5e80c2474eef2f7eef94f83db  guix-build-347a45d40c0d/output/x86_64-w64-mingw32/bitcoin-347a45d40c0d-win64.zip

Gitian builds:

  • Linux
Generating report
7f6b9251d2a7f0991c91eb96b21466b9798ab6f715871c485f239ea2abff186e  bitcoin-347a45d40c0d-aarch64-linux-gnu-debug.tar.gz
513a2b47811a0f896700fca152b139eba3c7da9c36993609d64ecbe3ecf4cba7  bitcoin-347a45d40c0d-aarch64-linux-gnu.tar.gz
14ff66645b7bce2675dbba932b67003a80891c14078820bdee2293ede8ce7ef0  bitcoin-347a45d40c0d-arm-linux-gnueabihf-debug.tar.gz
3fcd16876a712c291639d096f5e2b6dea908955754177d2a3680b1067ac1047f  bitcoin-347a45d40c0d-arm-linux-gnueabihf.tar.gz
398dab46c26041c77ff7e767bd0fb3f3f2f059b74995ce5f063b1297af20327d  bitcoin-347a45d40c0d-powerpc64-linux-gnu-debug.tar.gz
c041f14cfaf63ffd4fe753ad323eb1efd64e7fc4fc9ba7a2a208407380bb0d6e  bitcoin-347a45d40c0d-powerpc64-linux-gnu.tar.gz
dc270956eba3c52b481a6a8cae9fd3250d3b460ae648938e3f32ac53c532da0c  bitcoin-347a45d40c0d-powerpc64le-linux-gnu-debug.tar.gz
889142ea3376f5429996771ed1de5a9ac4eba5f595f976ab877841903439a751  bitcoin-347a45d40c0d-powerpc64le-linux-gnu.tar.gz
93cf2e3fd95064cced38db94dc388d50e1a5cd603e70a4a97bb71f3155282a1b  bitcoin-347a45d40c0d-riscv64-linux-gnu-debug.tar.gz
20413deb68c29eec0f8e07e117dde4a973986ee43025125b498518f718ad09a0  bitcoin-347a45d40c0d-riscv64-linux-gnu.tar.gz
3e01f68cfb4c12008b54eee253ce022df28d844d347a3f7382bb2509e09cd092  bitcoin-347a45d40c0d-x86_64-linux-gnu-debug.tar.gz
0ac8dc6d92a46d70de9a6f295075b1fa5c2ee6da7631238049e7a00d10fd6857  bitcoin-347a45d40c0d-x86_64-linux-gnu.tar.gz
87646c550c3b32df071464f608c86b468edb2b227321147fc1085c9dda17f518  src/bitcoin-347a45d40c0d.tar.gz
e4da41bd5eed8c447cd53a64f0c516d53e8aa7551a7df6c1c8ed3fef53c4f6ad  bitcoin-core-linux-22-res.yml
Done.
  • Windows
Generating report
7c9ffd0c4afd4fc93a265ab77c8df6793c7e3a9d63d2ff106ce106131fed6784  bitcoin-347a45d40c0d-win-unsigned.tar.gz
298991c5a0b7be19a00d61e8382c90b710de3fc100f06f880c3c7781ecb1ad15  bitcoin-347a45d40c0d-win64-debug.zip
016aabe2d3d78a1e791f8b6d24c9592aa44b52b5a1934d5aaa8d19a81ebde1b5  bitcoin-347a45d40c0d-win64-setup-unsigned.exe
b29b0ca9e31bd0066eff36bb920d0699e62a97134af838002ffc7de5dc57199a  bitcoin-347a45d40c0d-win64.zip
87646c550c3b32df071464f608c86b468edb2b227321147fc1085c9dda17f518  src/bitcoin-347a45d40c0d.tar.gz
420519f953cf33ad2a6eb64f57284bc3bafc4c4d2d5898206e86890e969341a1  bitcoin-core-win-22-res.yml
Done.
  • macOS
Generating report
f05f7feaef1ee495de27ba80d673ca63d91b812f617436c759102c46e9b42be9  bitcoin-347a45d40c0d-osx-unsigned.dmg
f3c966da3ab7516f736bc5471bcf20ee9530fb8d37b3ab05e86b4a93597e88cb  bitcoin-347a45d40c0d-osx-unsigned.tar.gz
ce3ad3701fe2fbc54f31e5b095f9fe6a1e038c3d84467c4a4d0e7252ef067c76  bitcoin-347a45d40c0d-osx64.tar.gz
87646c550c3b32df071464f608c86b468edb2b227321147fc1085c9dda17f518  src/bitcoin-347a45d40c0d.tar.gz
2809ec177a540dcd4531ad81ce45b3ed2b4d39ff37f901646f0a411a5dbd1de5  bitcoin-core-osx-22-res.yml
Done.

@ysangkok
Copy link

I verified that make -C src translate produces an XML file with an extracomment with the error message in the comment. I verified that build-unix.md suggests the package that includes lrelease. And I verified that the configure script errors if --with-gui is specified and qttools5-dev-tools is not installed on Ubuntu 20.04.2 LTS

.gitignore Outdated
@@ -56,6 +56,8 @@ src/qt/bitcoin-qt.creator
src/qt/bitcoin-qt.creator.user
src/qt/bitcoin-qt.files
src/qt/bitcoin-qt.includes
# An intermediate XLIFF translation file.
src/qt/locale/bitcoin_en.xlf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transifex auto-updates from the branch. If you want transifex to pick this file up instead of the .ts it needs to be checked in, not added to .gitignore.

Copy link
Member Author

@hebasto hebasto Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated.

hebasto added 4 commits April 20, 2021 15:48
The goal is to see the way the Transifex presents the added items to
translators using an intermediate XLIFF translation file.
As the bitcoin_en.xlf file is created by the `make -C src translate`
command, other translation-related files are also updated.
@hebasto
Copy link
Member Author

hebasto commented Apr 20, 2021

Updated 347a45d -> 35d5239 (pr21694.04 -> pr21694.05, diff):

Transifex auto-updates from the branch. If you want transifex to pick this file up instead of the .ts it needs to be checked in, not added to .gitignore.

@hebasto
Copy link
Member Author

hebasto commented Apr 20, 2021

The pr description is updated with an example of a translatable string presentation in the bitcoin_en.xlf file.

@laanwj
Copy link
Member

laanwj commented Apr 20, 2021

ACK 35d5239
Checked that the same src/qt/locale/bitcoin_en.xlf is generated locally.

@laanwj laanwj merged commit 90e0faa into bitcoin:master Apr 20, 2021
@hebasto hebasto deleted the 210415-xliff branch April 20, 2021 14:29
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 20, 2021
@hebasto
Copy link
Member Author

hebasto commented Apr 21, 2021

The actual results are presented in bitcoin-core/gui#287.

hebasto added a commit that referenced this pull request May 27, 2021
…lator comments

8b77133 qt: Replace disambiguation strings with translator comments (Hennadii Stepanov)

Pull request description:

  Since #21694 is merged, translator comments is the right way to pass context to translators.

  This PR fixes changes were made:
  - in #220 before #21694
  - in #21694 on testing purpose
  - in #125

  Closes #288.

ACKs for top commit:
  jarolrod:
    ACK 8b77133

Tree-SHA512: 466ade35f4969a41fbf3196780b1ae9fa810bab5d2f09077f8631604636cc63b24a901c719f6b5797366d2aa307993d0aa419ce35200c8d0a741a3d81cad3e6b
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 27, 2021
…lator comments

8b77133 qt: Replace disambiguation strings with translator comments (Hennadii Stepanov)

Pull request description:

  Since bitcoin#21694 is merged, translator comments is the right way to pass context to translators.

  This PR fixes changes were made:
  - in #220 before bitcoin#21694
  - in bitcoin#21694 on testing purpose
  - in #125

  Closes #288.

ACKs for top commit:
  jarolrod:
    ACK 8b77133

Tree-SHA512: 466ade35f4969a41fbf3196780b1ae9fa810bab5d2f09077f8631604636cc63b24a901c719f6b5797366d2aa307993d0aa419ce35200c8d0a741a3d81cad3e6b
laanwj added a commit that referenced this pull request Feb 4, 2022
985d85e Follow Transifex docs to prepare XLIFF source (Hennadii Stepanov)

Pull request description:

  This PR is a #21694 follow up.

  From the Transifex [docs](https://docs.transifex.com/formats/xliff#how-to-distinguish-between-a-source-file-and-a-translation-file):
  > A source file is different than a translation file. The translation file contains \<Target> references, whereas a source file does not.

  This PR makes the `qt/locale/bitcoin_en.xlf` source file according to the docs.

ACKs for top commit:
  laanwj:
    ACK 985d85e

Tree-SHA512: 537ef78f39a12f094b17fc902c5b59c7ae4d27e5fa35fbf6b33386843e4521236dac3275ba26ff2d1c435e53e8942284644d5de67b0b3543cec96cbcd4351607
kwvg added a commit to kwvg/dash that referenced this pull request Feb 17, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Feb 18, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Apr 25, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Apr 25, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Apr 26, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Apr 26, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Jun 10, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Jun 11, 2022
kwvg added a commit to kwvg/dash that referenced this pull request Jun 11, 2022
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Jul 13, 2022
backport: bitcoin#21694 (Use XLIFF file to provide more context to Transifex)
@bitcoin bitcoin locked and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

translation: Provide more context to Transifex translators
6 participants