Skip to content

i18n: Improve formatting an error message for multiple streams #1482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions libdnf5/base/log_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading