[Qt] Re-setup args after translator setup to translate help text #13289

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:qt-help-translations changing 2 files +10 −0
  1. achow101 commented at 2:27 AM on May 21, 2018: member

    tr() requires a QTranslator to be installed for it to translate, but we can't setup the args after setting up the QTranslator as setting that up requires looking up a command line argument. So instead we setup the arguments with the default text (tr() will resort to the default), then get the language to setup with and create the QTranslator, then clear the arguments and lastly setup the arguments again. The second arguments setup will allow the arguments to be translated with the QTranslator.

    Note that the contexts for some of the translations changed after #13190 so translations are not available for some strings where translations were previously available. Fixing that requires a translation resource update.

    Fixes #13287

  2. Re-setup args after translator setup to translate help text 59e136b708
  3. ken2812221 commented at 3:09 AM on May 21, 2018: contributor

    Tested ACK 59e136b

  4. in src/util.h:254 in 59e136b708
     247 | @@ -248,6 +248,11 @@ class ArgsManager
     248 |       */
     249 |      std::string GetChainName() const;
     250 |  
     251 | +    /**
     252 | +     * Clear available arguments
     253 | +     */
     254 | +    void ClearArgs() { m_available_args.clear(); }
    


    ken2812221 commented at 3:15 AM on May 21, 2018:

    Should this be inline?


    achow101 commented at 4:04 AM on May 21, 2018:

    It doesn't need to be not inline and this is simpler IMO


    Empact commented at 7:56 AM on May 21, 2018:

    Implementation should be *.cpp


    promag commented at 3:05 PM on May 21, 2018:

    @Empact why?


    Empact commented at 6:16 PM on May 21, 2018:

    According to developer-notes: "Implementation code should go into the .cpp file and not the .h, unless necessary due to template usage or when performance due to inlining is critical" This is kind of a trivial case so maybe worthy of an exception. Just repping the notes.

  5. jonasschnelli commented at 7:54 AM on May 21, 2018: contributor

    Tested a bit...

    But seems to not give me the same result then 0.16:

    this PR (German):

    ------ SNIP -------
      -rpcthreads=<n>
           Maximale Anzahl an Threads zur Verarbeitung von RPC-Anfragen festlegen
           (Standard: 4)
    
      -rpcuser=<user>
           Benutzername für JSON-RPC-Verbindungen
    
      -server
           Kommandozeilen- und JSON-RPC-Befehle annehmen
    
    UI Options:
    
      -choosedatadir
           Choose data directory on startup (default: 0)
    
      -lang=<lang>
           Set language, for example "de_DE" (default: system locale)
    
      -min
           Start minimized
    
      -resetguisettings
           Reset all settings changed in the GUI
    
      -rootcertificates=<file>
           Set SSL root certificates for payment request (default: -system-)
    
      -splash
           Show splash screen on startup (default: 1)
    

    0.16:

    ------ SNIP -------
      -rpcserialversion
           Setzt die Serialisierung von Rohtransaktionen oder Block Hex-Daten auf
           non-verbose mode, nicht-Segwit(0) oder Segwit(1) (default: 1)
    
      -rpcthreads=<n>
           Maximale Anzahl an Threads zur Verarbeitung von RPC-Anfragen festlegen
           (Standard: 4)
    
    UI Einstellungen:
    
      -choosedatadir
           Datenverzeichnis beim Starten auswählen (Standard: 0)
    
      -lang=<lang>
           Sprache einstellen, zum Beispiel "de_DE" (Standard: Systemgebietsschema)
    
      -min
           Minimiert starten
    
      -rootcertificates=<file>
           SSL-Wurzelzertifikate für Zahlungsanforderungen festlegen (Standard:
           Systemstandard)
    
      -splash
           Startbildschirm beim Starten anzeigen (Standard: 1)
    
      -resetguisettings
           Setze alle Einstellungen zurück, die über die grafische Oberfläche
           geändert wurden.
    
    
  6. ken2812221 commented at 8:12 AM on May 21, 2018: contributor

    @jonasschnelli They are not in the same context as 0.16.0, so it needs to be re-translated.

  7. jonasschnelli commented at 8:55 AM on May 21, 2018: contributor

    Okay. Fair point. Tested ACK 59e136b7080b1c5506e0a35c07083c2a91d368db

  8. promag commented at 3:14 PM on May 21, 2018: member

    utACK 59e136b.

  9. MarcoFalke commented at 3:17 PM on May 21, 2018: member

    so it needs to be re-translated.

    Hmm, I remember #10962...

  10. MarcoFalke added this to the milestone 0.17.0 on May 21, 2018
  11. laanwj commented at 3:24 PM on May 29, 2018: member

    Hmm, I remember #10962...

    Yes - I'd prefer just biting the bullet and doing that one. This adds one more fragile, order-dependent initialization step (to the bitcoin-qt initialization, which is already terrible in that regard).

  12. promag commented at 5:35 PM on May 29, 2018: member

    From #10962

    Many options are extremely technical, and refer internals, making it difficult to translate usefully

    This is a strong reason to ACK #13341 over this PR.

  13. achow101 commented at 8:21 PM on May 29, 2018: member

    Closing in favor of #13341 which removes translations from help entirely.

  14. achow101 closed this on May 29, 2018

  15. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:15 UTC

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