refactor: Use + instead of strformat to concatenate translated & untranslated strings

This change manually removes two strprintf(Untranslated...) calls. All
remaining calls are removed in the next scripted-diff commit.

Removing these calls makes code more consistent and makes it easier to
implement compile-time checking enforcing that format strings contain valid
specifiers, by avoiding the need for the Untranslated() function to be involved
in formatting.

Additionally, using + and += instead of strprintf here makes code a little
shorter, and more type-safe because + unlike strprintf only works on strings of
the same type, making it less likely english strings and bilingual strings will
be unintentionally combined.
This commit is contained in:
Ryan Ofsky
2024-10-11 20:15:32 -04:00
parent 831d2bfcf9
commit 006e4d1d59
2 changed files with 2 additions and 2 deletions

View File

@@ -6142,7 +6142,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
auto rename_result = m_snapshot_chainstate->InvalidateCoinsDBOnDisk();
if (!rename_result) {
user_error = strprintf(Untranslated("%s\n%s"), user_error, util::ErrorString(rename_result));
user_error += Untranslated("\n") + util::ErrorString(rename_result);
}
GetNotifications().fatalError(user_error);