Skip to content
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

I18N: Mark messages in "dnf info" output for a translation #1698

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 9 additions & 9 deletions dnf5/commands/list/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ void ListCommand::run() {
installed_latest.filter_latest_evr();
available.filter_nevra(installed_latest, libdnf5::sack::QueryCmp::NOT | libdnf5::sack::QueryCmp::LTE);
}
package_matched |= sections->add_section("Installed packages", installed);
package_matched |= sections->add_section("Available packages", available);
package_matched |= sections->add_section(_("Installed packages"), installed);
package_matched |= sections->add_section(_("Available packages"), available);
break;
}
case PkgNarrow::INSTALLED: {
package_matched |= sections->add_section("Installed packages", installed);
package_matched |= sections->add_section(_("Installed packages"), installed);
break;
}
case PkgNarrow::AVAILABLE: {
Expand All @@ -205,15 +205,15 @@ void ListCommand::run() {
base_query.filter_priority();
base_query.filter_latest_evr();
}
package_matched |= sections->add_section("Available packages", base_query);
package_matched |= sections->add_section(_("Available packages"), base_query);
break;
}
case PkgNarrow::UPGRADES:
base_query.filter_priority();
base_query.filter_upgrades();
base_query.filter_arch(std::vector<std::string>{"src", "nosrc"}, libdnf5::sack::QueryCmp::NEQ);
base_query.filter_latest_evr();
package_matched |= sections->add_section("Available upgrades", base_query);
package_matched |= sections->add_section(_("Available upgrades"), base_query);
break;
case PkgNarrow::OBSOLETES: {
base_query.filter_priority();
Expand All @@ -229,16 +229,16 @@ void ListCommand::run() {
}
obsoletes.emplace(pkg.get_id(), obsoleted);
}
package_matched |= sections->add_section("Obsoleting packages", base_query, obsoletes);
package_matched |= sections->add_section(_("Obsoleting packages"), base_query, obsoletes);
break;
}
case PkgNarrow::AUTOREMOVE:
installed.filter_unneeded();
package_matched |= sections->add_section("Autoremove packages", installed);
package_matched |= sections->add_section(_("Autoremove packages"), installed);
break;
case PkgNarrow::EXTRAS:
base_query.filter_extras();
package_matched |= sections->add_section("Extra packages", base_query);
package_matched |= sections->add_section(_("Extra packages"), base_query);
break;
case PkgNarrow::RECENT:
base_query.filter_available();
Expand All @@ -249,7 +249,7 @@ void ListCommand::run() {
auto recent_limit_days = config.get_recent_option().get_value();
auto now = time(NULL);
base_query.filter_recent(now - (recent_limit_days * 86400));
package_matched |= sections->add_section("Recently added packages", base_query);
package_matched |= sections->add_section(_("Recently added packages"), base_query);
break;
}

Expand Down
39 changes: 22 additions & 17 deletions libdnf5-cli/output/packageinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,27 @@ void print_package_info(
scols_table_enable_noheadings(table, 1);
scols_table_new_column(table, "key", 1, 0);
scols_table_new_column(table, "value", 1, SCOLS_FL_WRAP);
scols_table_set_column_separator(table, " : ");
// Note for translators: This is a right-aligned column separator in
// a package properties table as in "Name : bash".
scols_table_set_column_separator(table, _(" : "));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected that the translators know what purpose this string serve or should a note, such as https://github.com/rpm-software-management/dnf5/blob/main/dnf5daemon-client/commands/advisory/arguments.hpp#L153-L154 , be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a comment. I'm not sure how to describe it. Because the colon here is abused as a column separator. The current use in the English text is wrong from typographical point of view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this notice:

    // Note for translators: This is a right-aligned column separator in
    // a package properties table as in "Name    : bash".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

if (libdnf5::cli::tty::is_interactive()) {
scols_table_enable_colors(table, 1);
}

// Add package
struct libscols_line * first_line = add_line(table, "Name", pkg.get_name());
struct libscols_line * first_line = add_line(table, _("Name"), pkg.get_name());
if (colorizer) {
scols_line_set_color(first_line, colorizer->get_pkg_color(pkg).c_str());
}

add_line(table, "Epoch", pkg.get_epoch());
add_line(table, "Version", pkg.get_version());
add_line(table, "Release", pkg.get_release());
add_line(table, "Architecture", pkg.get_arch());
add_line(table, _("Epoch"), pkg.get_epoch());
add_line(table, _("Version"), pkg.get_version());
add_line(table, _("Release"), pkg.get_release());
add_line(table, _("Architecture"), pkg.get_arch());

if (!obsoletes.empty()) {
auto iterator = obsoletes.begin();
add_line(table, "Obsoletes", iterator->get_full_nevra());
add_line(table, _("Obsoletes"), iterator->get_full_nevra());
++iterator;
for (; iterator != obsoletes.end(); ++iterator) {
add_line(table, "", iterator->get_full_nevra());
Expand All @@ -79,29 +81,32 @@ void print_package_info(

if (!pkg.is_installed()) {
add_line(
table, "Download size", utils::units::format_size_aligned(static_cast<int64_t>(pkg.get_download_size())));
table,
_("Download size"),
utils::units::format_size_aligned(static_cast<int64_t>(pkg.get_download_size())));
}
add_line(table, "Installed size", utils::units::format_size_aligned(static_cast<int64_t>(pkg.get_install_size())));
add_line(
table, _("Installed size"), utils::units::format_size_aligned(static_cast<int64_t>(pkg.get_install_size())));
if (pkg.get_arch() != "src") {
add_line(table, "Source", pkg.get_sourcerpm());
add_line(table, _("Source"), pkg.get_sourcerpm());
}
if (pkg.is_installed()) {
add_line(table, "From repository", pkg.get_from_repo_id());
add_line(table, _("From repository"), pkg.get_from_repo_id());
} else {
add_line(table, "Repository", pkg.get_repo_id());
add_line(table, _("Repository"), pkg.get_repo_id());
}
add_line(table, "Summary", pkg.get_summary());
add_line(table, "URL", pkg.get_url());
add_line(table, "License", pkg.get_license());
add_line(table, _("Summary"), pkg.get_summary());
add_line(table, _("URL"), pkg.get_url());
add_line(table, _("License"), pkg.get_license());

auto lines = libdnf5::utils::string::split(pkg.get_description(), "\n");
auto iterator = lines.begin();
add_line(table, "Description", *iterator);
add_line(table, _("Description"), *iterator);
++iterator;
for (; iterator != lines.end(); ++iterator) {
add_line(table, "", *iterator);
}
add_line(table, "Vendor", pkg.get_vendor());
add_line(table, _("Vendor"), pkg.get_vendor());

scols_print_table(table);
scols_unref_table(table);
Expand Down
Loading