Apply translator comments to reset options confirmation dialog #627

pull jarolrod wants to merge 1 commits into bitcoin-core:master from jarolrod:617-followup changing 1 files +12 −4
  1. jarolrod commented at 3:48 am on June 30, 2022: member

    This is a followup to #617. Because the strings were being concatenated, we can not apply translator comments to all of the revelant strings. This can be tested by applying the following diff to current master and running make translate; then check the resulting diff:

     0diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
     1index 462b923d6..3cf165004 100644
     2--- a/src/qt/optionsdialog.cpp
     3+++ b/src/qt/optionsdialog.cpp
     4@@ -286,9 +286,17 @@ void OptionsDialog::on_resetButton_clicked()
     5 {
     6     if (model) {
     7         // confirmation dialog
     8+        //: Window title text of pop-up window shown when the user has chosen to reset options.
     9         QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
    10+            /*: Text explaining that the settings the user changed will not come
    11+                into effect until the client is restarted. */
    12             tr("Client restart required to activate changes.") + "<br><br>" +
    13+            /*: Text explaining to the user that the client's current settings
    14+                will be backed up at a specific location. %1 is a stand-in
    15+                argument for the backup location's path. */
    16             tr("Current settings will be backed up at \"%1\".").arg(m_client_model->dataDir()) + "<br><br>" +
    17+            /*: Text asking the user to confirm if they would like to proceed
    18+                with a client shutdown. */
    19             tr("Client will be shut down. Do you want to proceed?"),
    20             QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
    

    To apply the above translator comments, what we want to do instead is have a variable in which the translatable strings are appended to using the QString append function.

    When you run make translate with this PR, you will see the translator comments properly applied, as shown below:

     0diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts
     1index 35d820187..9e5158b3e 100644
     2--- a/src/qt/locale/bitcoin_en.ts
     3+++ b/src/qt/locale/bitcoin_en.ts
     4@@ -1942,28 +1942,37 @@ Signing is only possible with addresses of the type &apos;legacy&apos;.</source>
     5         <translation>default</translation>
     6     </message>
     7     <message>
     8-        <location line="+81"/>
     9+        <location line="+86"/>
    10         <source>none</source>
    11         <translation type="unfinished"></translation>
    12     </message>
    13     <message>
    14-        <location line="+97"/>
    15+        <location line="+107"/>
    16         <source>Confirm options reset</source>
    17+        <extracomment>Window title text of pop-up window shown when the user has chosen to reset options.</extracomment>
    18         <translation>Confirm options reset</translation>
    19     </message>
    20     <message>
    21-        <location line="+1"/>
    22-        <location line="+70"/>
    23+        <location line="-9"/>
    24+        <location line="+79"/>
    25         <source>Client restart required to activate changes.</source>
    26+        <extracomment>Text explaining that the settings changed will not come into effect until the client is restarted.</extracomment>
    27+        <translation type="unfinished"></translation>
    28+    </message>
    29+    <message>
    30+        <location line="-75"/>
    31+        <source>Current settings will be backed up at &quot;%1&quot;.</source>
    32+        <extracomment>Text explaining to the user that the client&apos;s current settings will be backed up at a specific location. %1 is a stand-in argument for the backup location&apos;s path.</extracomment>
    33         <translation type="unfinished"></translation>
    34     </message>
    35     <message>
    36-        <location line="-70"/>
    37+        <location line="+3"/>
    38         <source>Client will be shut down. Do you want to proceed?</source>
    39+        <extracomment>Text asking the user to confirm if they would like to proceed with a client shutdown.</extracomment>
    40         <translation type="unfinished"></translation>
    41     </message>
    42     <message>
    43-        <location line="+18"/>
    44+        <location line="+20"/>
    45         <source>Configuration options</source>
    46         <extracomment>Window title text of pop-up box that allows opening up of configuration file.</extracomment>
    47         <translation type="unfinished"></translation>
    

    No difference in rendering between master and PR

    master PR
  2. qt: apply translator comments to reset options confirmation dialog
    Follow-up to #617. This applies translator strings to the
    reset options confirmation dialog and also refactors the way we pass the
    strings to the dialog in order to allow the comments to be applied.
    Because the strings were being concatenated, we can not apply translator
    comments to all of the relevant strings. What we want to do instead is
    have a variable in which the translatable strings are appended to using
    the QString append function. This satisfies the Qt translator engine and
    the comments are then properly applied within the `extracomment` field
    in the translation file.
    d5c141f221
  3. jarolrod renamed this:
    qt: apply translator comments to reset options confirmation dialog
    Apply translator comments to reset options confirmation dialog
    on Jun 30, 2022
  4. jarolrod added the label Translations on Jun 30, 2022
  5. shaavan approved
  6. shaavan commented at 6:27 pm on July 1, 2022: contributor

    ACK d5c141f221d67aaeee989da0db0ac5383d7562d3

    • I was able to verify that applying the patch given in the description leads to failing of make translate.

    Master_Patch_Translate

    • The make translate command ran successfully for this PR.
    • I was able to verify that the displayed message remains unchanged.

    Screenshot:

    Master PR
    Master Screenshot from 2022-07-01 23-49-30

    Notes: Instructions on how to using make translate are given in this documentation

  7. furszy approved
  8. furszy commented at 3:39 pm on July 11, 2022: contributor
    Tested ACK d5c141f2, no functional changes.
  9. w0xlt approved
  10. hebasto merged this on Jul 12, 2022
  11. hebasto closed this on Jul 12, 2022

  12. sidhujag referenced this in commit 990f7e7465 on Jul 12, 2022
  13. bitcoin-core locked this on Jul 12, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me