Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Nov 16, 2020

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 :)

Command line option name must not be a part of the translatable string,
as it is untranslatable by its nature.
RPC name must not be a part of the translatable string, as it is
untranslatable by its nature.
Added requirement to do not translate names.
@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 17, 2020

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.

@decryp2kanon
Copy link
Contributor

ACK c20e3db

Good idea 👍

@@ -4041,7 +4041,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
}

if (rescan_height != block_height) {
error = _("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
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");
Copy link
Contributor

@decryp2kanon decryp2kanon Nov 18, 2020

Choose a reason for hiding this comment

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

nit: blockchain vs block chain

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

This isn't optech

@maflcko
Copy link
Member

maflcko commented Nov 18, 2020

If we want to avoid this in the future, would a linter be appropriate?

@laanwj
Copy link
Member

laanwj commented Nov 18, 2020

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.)

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

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?

@@ -1416,16 +1420,16 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
}
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
if (strSubVersion.size() > MAX_SUBVERSION_LENGTH) {
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
strSubVersion.size(), MAX_SUBVERSION_LENGTH));
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of %s."),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of %s."),
return InitError(strprintf(_("Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of %s options."),


The following tokens must not be parts of the strings are to be translated:
- command line option names
- RPC names
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- RPC names
- RPC method and parameter names

Comment on lines +1023 to +1026
return InitError(strprintf(_("Prune mode is incompatible with %s."), "-txindex"));
}
if (!g_enabled_filter_types.empty()) {
return InitError(_("Prune mode is incompatible with -blockfilterindex."));
return InitError(strprintf(_("Prune mode is incompatible with %s."), "-blockfilterindex"));
Copy link
Member

Choose a reason for hiding this comment

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

Should we combine these (like ResolveErrMsg)?

@@ -1197,7 +1201,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
nMaxTipAge = args.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);

if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) {
return InitError(_("No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>."));
return InitError(strprintf(_("No proxy server specified. Use %s or %s."), "-proxy=<ip>", "-proxy=<ip:port>"));
Copy link
Member

Choose a reason for hiding this comment

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

It might make sense to translate the =<ip:port> parts?

Comment on lines +1453 to +1458
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-proxy", proxyArg));
}

proxyType addrProxy = proxyType(proxyAddr, proxyRandomize);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address or hostname: '%s'"), proxyArg));
if (!addrProxy.IsValid()) {
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-proxy", proxyArg));
Copy link
Member

Choose a reason for hiding this comment

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

Another candidate for combining

Comment on lines +1478 to +1482
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
}
proxyType addrOnion = proxyType(onionProxy, proxyRandomize);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address or hostname: '%s'"), onionArg));
if (!addrOnion.IsValid()) {
return InitError(strprintf(_("Invalid %s address or hostname: '%s'"), "-onion", onionArg));
Copy link
Member

Choose a reason for hiding this comment

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

combine

@@ -2961,7 +2961,7 @@ bool CWallet::CreateTransactionInternal(
nFeeNeeded = GetMinimumFee(*this, nBytes, coin_control, &feeCalc);
if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
// eventually allow a fallback fee
error = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
error = strprintf(_("Fee estimation failed. %s is disabled. Wait a few blocks or enable %s."), "-fallbackfee", "-fallbackfee");
Copy link
Member

Choose a reason for hiding this comment

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

First one should probably be translated...

@@ -3935,7 +3935,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
if (gArgs.IsArgSet("-discardfee")) {
CAmount nFeePerK = 0;
if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {
error = strprintf(_("Invalid amount for -discardfee=<amount>: '%s'"), gArgs.GetArg("-discardfee", ""));
error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-discardfee", gArgs.GetArg("-discardfee", ""));
Copy link
Member

Choose a reason for hiding this comment

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

This message seems reusable

@@ -4041,7 +4041,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
}

if (rescan_height != block_height) {
error = _("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
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");
Copy link
Member

Choose a reason for hiding this comment

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

This isn't optech

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 2, 2021

🐙 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".

@hebasto
Copy link
Member Author

hebasto commented Mar 16, 2021

@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

return InitError(_("No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>."));

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?

@laanwj
Copy link
Member

laanwj commented Mar 16, 2021

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.

@hebasto
Copy link
Member Author

hebasto commented Mar 16, 2021

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.

@hebasto hebasto marked this pull request as draft March 16, 2021 23:54
@hebasto
Copy link
Member Author

hebasto commented May 16, 2021

Closing for now. Leaving up for grabs.

@hebasto hebasto closed this May 16, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
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.

6 participants