From 058021969b542fc865d17d22fa21e48c9abe4a6e Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Fri, 11 Oct 2024 14:12:12 -0400 Subject: [PATCH] refactor: Avoid concatenation of format strings Instead just concatenate already formatted strings. This allows untranslated format strings to be checked at compile time now, and translated format strings to be checked at compile time in #31061. --- src/init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 19efc69aaa2..7182270de77 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -886,7 +886,7 @@ bool AppInitParameterInteraction(const ArgsManager& args) } bilingual_str errors; for (const auto& arg : args.GetUnsuitableSectionOnlyArgs()) { - errors += strprintf(_("Config setting for %s only applied on %s network when in [%s] section.") + Untranslated("\n"), arg, ChainTypeToString(chain), ChainTypeToString(chain)); + errors += strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, ChainTypeToString(chain), ChainTypeToString(chain)) + Untranslated("\n"); } if (!errors.empty()) { @@ -901,7 +901,7 @@ bool AppInitParameterInteraction(const ArgsManager& args) // Warn if unrecognized section name are present in the config file. bilingual_str warnings; for (const auto& section : args.GetUnrecognizedSections()) { - warnings += strprintf(Untranslated("%s:%i ") + _("Section [%s] is not recognized.") + Untranslated("\n"), section.m_file, section.m_line, section.m_name); + warnings += Untranslated(strprintf("%s:%i ", section.m_file, section.m_line)) + strprintf(_("Section [%s] is not recognized."), section.m_name) + Untranslated("\n"); } if (!warnings.empty()) {