mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-02 01:04:43 +02:00
Merge bitcoin/bitcoin#31072: refactor: Clean up messy strformat and bilingual_str usages
0184d33b3dscripted-diff: Replace strprintf(Untranslated) with Untranslated(strprintf) (Ryan Ofsky)006e4d1d59refactor: Use + instead of strformat to concatenate translated & untranslated strings (Ryan Ofsky)831d2bfcf9refactor: Don't embed translated string in untranslated string. (Ryan Ofsky)058021969brefactor: Avoid concatenation of format strings (Ryan Ofsky) Pull request description: This PR cleans up string formatting in the codebase so other PRs adding compile time checking can be simpler and easier to review (specifically #30928, #31061, #31074, and #31149). Currently these PRs are hard to review because in addition to changing formatting APIs, they have to update callers that are using the API's in unusual ways. Clean up these callers now so later PRs can be simpler. Specifically: - Use string literals instead of `std::string` format strings to enable more compile-time checking. - Avoid using untranslated bilingual strings as format strings. Use originals so they can by checked at compile time. - Favor `Untranslated(strprintf(...))` over `strprintf(Untranslated(...), ...)` for consistency and to prevent translated and untranslated strings from being unintentionally combined. ACKs for top commit: maflcko: lgtm ACK0184d33b3d🔹 l0rinc: ACK0184d33b3d- no overall difference because of the rebase Tree-SHA512: 37eb771187d30977f5f054eddb82af6dd69878ace89cede72032bb389e57200898119f9fe486ce6903ebb00cb24648be215ab3e44842b3d206b35e26038da750
This commit is contained in:
@@ -42,7 +42,7 @@ util::Result<int> IntFn(int i, bool success)
|
||||
util::Result<bilingual_str> StrFn(bilingual_str s, bool success)
|
||||
{
|
||||
if (success) return s;
|
||||
return util::Error{strprintf(Untranslated("str %s error."), s.original)};
|
||||
return util::Error{Untranslated(strprintf("str %s error.", s.original))};
|
||||
}
|
||||
|
||||
util::Result<NoCopy> NoCopyFn(int i, bool success)
|
||||
|
||||
Reference in New Issue
Block a user