Description of problem: We are trying to translate some string but we are failing to understand the difference between _("Repo-excluded: ") and _("Repo-exclude : ") https://github.com/rpm-software-management/dnf/blob/master/dnf/cli/commands/repolist.py#L220 https://github.com/rpm-software-management/dnf/blob/master/dnf/cli/commands/repolist.py#L228 In general, more translator comments would help a lot, explaining what we are talking about! List of packages? Number of packages? btw, "ui_excludes_num" does not looks like to receive any value which is a surprise (or a demonstration I'm not a dev ;)).
We will take a look how yum names these tags. Maybe we should rename whole string to be more understandable for users.
Please do you know how to add comments for translation into code? Example from code: if ui_excludes_num: out += [self.output.fmtKeyValFill(_("Repo-excluded: "), ui_excludes_num)] In other hand: Repo-exclude: # Packages that are excluded - their names (dnf systemd) Repo-excluded: # Number of packages that where excluded (5)
Additionally, Repo-exclude does not show all excludes (from dnf.conf, commandline and .repo) and Repo-excluded is not shown at all (the calculation of excluded packages is not implemented).
(In reply to Jaroslav Mracek from comment #2) > Please do you know how to add comments for translation into code? > > Example from code: > if ui_excludes_num: > out += [self.output.fmtKeyValFill(_("Repo-excluded: "), > ui_excludes_num)] > > In other hand: > > Repo-exclude: # Packages that are excluded - their names (dnf systemd) > > Repo-excluded: # Number of packages that where excluded (5) I tried this in ibus-typing-booster (also written in Python3). Apparently, adding a comment line directly before the line containing the message and starting the comment with “TRANSLATORS:” (all uppercase) works. Like this for example: diff --git a/setup/main.py b/setup/main.py index 16985ac..6f9204b 100644 --- a/setup/main.py +++ b/setup/main.py @@ -110,6 +110,7 @@ class SetupUI: Gtk.MessageType.WARNING) except: self.__run_message_dialog( + # TRANSLATORS: here is a comment _("IBUS_ENGINE_NAME environment variable is not set."), Gtk.MessageType.WARNING) if self.config_file == None: It worked for me only when the comment was directly above, for example this did *not* work: diff --git a/setup/main.py b/setup/main.py index 16985ac..63d5c5b 100644 --- a/setup/main.py +++ b/setup/main.py @@ -109,6 +109,7 @@ class SetupUI: %{'name': ibus_engine_name}, Gtk.MessageType.WARNING) except: + # TRANSLATORS: here is a comment self.__run_message_dialog( _("IBUS_ENGINE_NAME environment variable is not set."), Gtk.MessageType.WARNING)
Clear needinfo.
Will this work? # TRANSLATORS: Number of packages that where excluded (5) out += [self.output.fmtKeyValFill(_("Repo-excluded: "), ui_excludes_num)] There is a commit that provides requested information: https://github.com/rpm-software-management/dnf/pull/673
(In reply to Jaroslav Mracek from comment #6) > Will this work? > > # TRANSLATORS: Number of packages that where excluded (5) > out += [self.output.fmtKeyValFill(_("Repo-excluded: "), > ui_excludes_num)] > > > There is a commit that provides requested information: > https://github.com/rpm-software-management/dnf/pull/673 Yes, this will work.
(In reply to Mike FABIAN from comment #7) > (In reply to Jaroslav Mracek from comment #6) > > Will this work? > > > > # TRANSLATORS: Number of packages that where excluded (5) > > out += [self.output.fmtKeyValFill(_("Repo-excluded: "), > > ui_excludes_num)] > > > > > > There is a commit that provides requested information: > > https://github.com/rpm-software-management/dnf/pull/673 > > Yes, this will work. But take care that xgettext is called with the -c option! From the man-page of xgettext: -cTAG, --add-comments=TAG place comment blocks starting with TAG and preceding keyword lines in output file -c, --add-comments place all comment blocks preceding keyword lines in output file To add the -c option, one may need to add that option to a Makevars file in the po directory, as it is done for example in ibus-typing-booster here: https://github.com/mike-fabian/ibus-typing-booster/blob/master/po/Makevars#L11 In case of ibus-typing-booster, xgettext is called as follows when executing "make dist": /usr/bin/xgettext --default-domain=ibus-typing-booster --directory=.. \ --add-comments=TRANSLATORS: -c --keyword=_ --keyword=N_ \ --files-from=./POTFILES.in \ --copyright-holder='Anish Patil <anish.developer>' \ --msgid-bugs-address="$msgid_bugs_address"
Maybe you need to add the -c option here?: https://github.com/rpm-software-management/dnf/blob/master/po/CMakeLists.txt
The patch was released in dnf-2.0.0-1 into rawhide and fc26.