From 705ecb8bfdf3e572723fbc0552a4e3405e2cae2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 10 May 2024 10:58:40 +0200 Subject: [PATCH] i18n: Improve formatting an error message for multiple streams The leading message glued paragraphs and a missing space in _("Unable to resolve argument '{}':{}") was confusing for the translators. A continuations of the message also did not suport plural forms. Both issues are fixed with this patch. The singular form will never be used, but the many plural ones will do. Fixes: #1480 --- libdnf5/base/log_event.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libdnf5/base/log_event.cpp b/libdnf5/base/log_event.cpp index 9592bfe68..1161ff334 100644 --- a/libdnf5/base/log_event.cpp +++ b/libdnf5/base/log_event.cpp @@ -234,19 +234,22 @@ std::string LogEvent::to_string( const auto pos = module_stream.find(":"); module_dict[module_stream.substr(0, pos)].insert(module_stream.substr(pos + 1)); } - // Create the error message describing all the streams of modules that were matched. - std::string error_message; + // Format a leading line of the error message. + ret.append(utils::sformat(_("Unable to resolve argument '{}':"), *spec)); + // Describe all the streams of modules that were matched. for (const auto & module_dict_iter : module_dict) { - error_message.append(utils::sformat( - _("\n - Argument '{}' matches {} streams ('{}') of module '{}', but none of the streams are " - "enabled or " - "default."), + ret.append(utils::sformat( + P_("\n - Argument '{}' matches {} stream ('{}') of module '{}', " + "but the stream is not enabled or default.", + "\n - Argument '{}' matches {} streams ('{}') of module '{}', " + "but none of the streams are enabled or default.", + module_dict_iter.second.size()), *spec, module_dict_iter.second.size(), - utils::string::join(module_dict_iter.second, "', '"), + utils::string::join(module_dict_iter.second, _("', '")), module_dict_iter.first)); } - return ret.append(utils::sformat(_("Unable to resolve argument '{}':{}"), *spec, error_message)); + return ret; } case GoalProblem::MODULE_SOLVER_ERROR: { if (!solver_problems) {