Remove names from translatable strings #20404

pull hebasto wants to merge 5 commits into bitcoin:master from hebasto:201116-tr changing 10 files +61 −46
  1. hebasto commented at 6:59 pm on November 16, 2020: member

    This PR removes the following tokens from translatable strings:

    • command line option names
    • RPC names
    • debug log file name

    All of them are untranslatable by their nature.

    The Translation Strings Policy updated accordingly.

    This was done while reviewing #20401. Good to get it just after 0.21 branch off :)

  2. Do not translate command line option names
    Command line option name must not be a part of the translatable string,
    as it is untranslatable by its nature.
    8077dc3860
  3. Do not translate RPC names
    RPC name must not be a part of the translatable string, as it is
    untranslatable by its nature.
    229f45f172
  4. Do not translate debug log file name 7d7c5a4b79
  5. Drop unneeded '\n' from translatable string 274078b4d3
  6. doc: Update Translation Strings Policy
    Added requirement to do not translate names.
    c20e3db81a
  7. DrahtBot added the label Docs on Nov 16, 2020
  8. DrahtBot added the label P2P on Nov 16, 2020
  9. DrahtBot added the label UTXO Db and Indexes on Nov 16, 2020
  10. DrahtBot added the label Validation on Nov 16, 2020
  11. DrahtBot added the label Wallet on Nov 16, 2020
  12. DrahtBot commented at 1:17 am on November 17, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20773 (refactor: split CWallet::Create by S3RK)
    • #20640 (wallet, refactor: return out-params of CreateTransaction() as optional struct by theStack)
    • #20546 (wallet: check for non-representable CFeeRates by jonatack)
    • #19509 (Per-Peer Message Capture by troygiorshev)
    • #19358 (torcontrol : avoid to set wrong outbound proxy and network settings when creating an inbound onion service. by Saibato)
    • #17526 (Use Single Random Draw In addition to knapsack as coin selection fallback by achow101)
    • #17331 (Use effective values throughout coin selection by achow101)
    • #15946 (Allow maintaining the blockfilterindex when using prune by jonasschnelli)

    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.

  13. MarcoFalke removed the label P2P on Nov 17, 2020
  14. MarcoFalke removed the label UTXO Db and Indexes on Nov 17, 2020
  15. MarcoFalke removed the label Validation on Nov 17, 2020
  16. MarcoFalke removed the label Wallet on Nov 17, 2020
  17. MarcoFalke added the label GUI on Nov 17, 2020
  18. decryp2kanon commented at 8:13 am on November 18, 2020: contributor

    ACK c20e3db

    Good idea :+1:

  19. in src/wallet/wallet.cpp:4044 in c20e3db81a
    4040@@ -4041,7 +4041,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
    4041             }
    4042 
    4043             if (rescan_height != block_height) {
    4044-                error = _("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
    4045+                error = strprintf(_("Prune: last wallet synchronisation goes beyond pruned data. You need to %s (download the whole block chain again in case of pruned node)."), "-reindex");
    


    decryp2kanon commented at 8:14 am on November 18, 2020:
    nit: blockchain vs block chain


    luke-jr commented at 11:47 pm on November 24, 2020:
    This isn’t optech
  20. MarcoFalke commented at 8:27 am on November 18, 2020: member
    If we want to avoid this in the future, would a linter be appropriate?
  21. laanwj commented at 11:25 am on November 18, 2020: member
    I understand the idea but… Doesn’t this make it much harder for translators to understand what is being translated? A lot of context information goes missing by replacing these with placeholders. (the most common kind of question that I get on transifex is already “I don’t understand the context of this message, please explain”. It might also result in less specific and relevant translations.)
  22. in src/init.cpp:1423 in c20e3db81a
    1419@@ -1416,16 +1420,16 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
    1420     }
    1421     strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
    1422     if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
    1423-        return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
    1424-            strSubVersion.size(), MAX_SUBVERSION_LENGTH));
    1425+        return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of %s."),
    


    luke-jr commented at 11:39 pm on November 24, 2020:
    0        return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of %s options."),
    
  23. in doc/translation_strings_policy.md:37 in c20e3db81a
    29@@ -30,6 +30,15 @@ This includes messages passed to the GUI through the UI interface through `InitM
    30 General recommendations
    31 ------------------------
    32 
    33+### Do not translate names
    34+
    35+The following tokens must not be parts of the strings are to be translated:
    36+- command line option names
    37+- RPC names
    


    luke-jr commented at 11:39 pm on November 24, 2020:
    0- RPC method and parameter names
    
  24. in src/init.cpp:1026 in c20e3db81a
    1025+        if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
    1026+            return InitError(strprintf(_("Prune mode is incompatible with %s."), "-txindex"));
    1027+        }
    1028         if (!g_enabled_filter_types.empty()) {
    1029-            return InitError(_("Prune mode is incompatible with -blockfilterindex."));
    1030+            return InitError(strprintf(_("Prune mode is incompatible with %s."), "-blockfilterindex"));
    


    luke-jr commented at 11:41 pm on November 24, 2020:
    Should we combine these (like ResolveErrMsg)?
  25. in src/init.cpp:1204 in c20e3db81a
    1200@@ -1197,7 +1201,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
    1201     nMaxTipAge = args.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
    1202 
    1203     if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) {
    1204-        return InitError(_("No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>."));
    1205+        return InitError(strprintf(_("No proxy server specified. Use %s or %s."), "-proxy=<ip>", "-proxy=<ip:port>"));
    


    luke-jr commented at 11:43 pm on November 24, 2020:
    It might make sense to translate the =<ip:port> parts?
  26. in src/init.cpp:1458 in c20e3db81a
    1456 
    1457         proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
    1458-        if (!addrProxy.IsValid())
    1459-            return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
    1460+        if (!addrProxy.IsValid()) {
    1461+            return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-proxy", proxyArg));
    


    luke-jr commented at 11:43 pm on November 24, 2020:
    Another candidate for combining
  27. in src/init.cpp:1482 in c20e3db81a
    1480             }
    1481             proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
    1482-            if (!addrOnion.IsValid())
    1483-                return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
    1484+            if (!addrOnion.IsValid()) {
    1485+                return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
    


    luke-jr commented at 11:44 pm on November 24, 2020:
    combine
  28. in src/wallet/wallet.cpp:2964 in c20e3db81a
    2960@@ -2961,7 +2961,7 @@ bool CWallet::CreateTransactionInternal(
    2961                 nFeeNeeded = GetMinimumFee(*this, nBytes, coin_control, &feeCalc);
    2962                 if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
    2963                     // eventually allow a fallback fee
    2964-                    error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
    2965+                    error = strprintf(_("Fee estimation failed. %s is disabled. Wait a few blocks or enable %s."), "-fallbackfee", "-fallbackfee");
    


    luke-jr commented at 11:46 pm on November 24, 2020:
    First one should probably be translated…
  29. in src/wallet/wallet.cpp:3938 in c20e3db81a
    3934@@ -3935,7 +3935,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
    3935     if (gArgs.IsArgSet("-discardfee")) {
    3936         CAmount nFeePerK = 0;
    3937         if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {
    3938-            error = strprintf(_("Invalid amount for -discardfee=<amount>: '%s'"), gArgs.GetArg("-discardfee", ""));
    3939+            error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-discardfee", gArgs.GetArg("-discardfee", ""));
    


    luke-jr commented at 11:46 pm on November 24, 2020:
    This message seems reusable
  30. luke-jr changes_requested
  31. luke-jr commented at 11:48 pm on November 24, 2020: member

    Concept ACK

    Doesn’t this make it much harder for translators to understand what is being translated? A lot of context information goes missing by replacing these with placeholders.

    Qt lets you specify an additional string seen only by translators for context. Does Transifex support that? Can we add it to our utils too?

  32. DrahtBot added the label Needs rebase on Feb 2, 2021
  33. DrahtBot commented at 2:13 pm on February 2, 2021: member

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  34. hebasto commented at 11:14 pm on March 16, 2021: member

    @laanwj

    I understand the idea but… Doesn’t this make it much harder for translators to understand what is being translated? A lot of context information goes missing by replacing these with placeholders.

    I understand your concerns. Yes, translators will lose some part of context with this approach. OTOH, for https://github.com/bitcoin/bitcoin/blob/7d8a10a6f4d61df1f4afb138e379149565afa02d/src/init.cpp#L1200

    just spotted the following translation:

    DeepinScreenshot_select-area_20210317011131

    (the most common kind of question that I get on transifex is already “I don’t understand the context of this message, please explain”. It might also result in less specific and relevant translations.)

    Does answering those questions resolve translators’ lack of context?

  35. laanwj commented at 11:41 pm on March 16, 2021: member

    Does answering those questions resolve translators’ lack of context?

    Not really—in the sense that it’s not a scalable approach, and also many will not ask and just assume something (often wrongly). If there is some other way to provide context that is shown in the translator (like the translation comment) I guess that would work though.

  36. hebasto commented at 11:51 pm on March 16, 2021: member

    If there is some other way to provide context that is shown in the translator (like the translation comment) I guess that would work though.

    From https://docs.transifex.com/localization-tips-workflows/the-complete-guide-to-adding-context-to-strings

    DEVELOPER NOTES… These types of notes are added to source files by developers. Not all file formats support developer notes though. The file types which support developer notes are the following: Android XML, Apple PLIST, Apple Strings, JSON (Chrome), Structured JSON, PO, Mozilla DTD, Windows Resx, Resw and Resjson, Xliff, xlsx (as context) and YAML.

    Qt files are not mentioned, unfortunately.

  37. hebasto marked this as a draft on Mar 16, 2021
  38. hebasto commented at 11:04 pm on May 16, 2021: member
    Closing for now. Leaving up for grabs.
  39. hebasto closed this on May 16, 2021

  40. DrahtBot locked this on Aug 16, 2022

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: 2024-11-17 12:12 UTC

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