Bug 1386078 - L10N - Explain repoquery strings
L10N - Explain repoquery strings
Status: POST
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
: EasyFix, i18n, Triaged, UserExperience
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-18 01:29 EDT by jibecfed
Modified: 2017-03-22 11:50 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description jibecfed 2016-10-18 01:29:48 EDT
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 ;)).
Comment 1 Honza Silhan 2016-10-24 07:15:17 EDT
We will take a look how yum names these tags. Maybe we should rename whole string to be more understandable for users.
Comment 2 Jaroslav Mracek 2016-10-24 09:14:12 EDT
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)
Comment 3 Jaroslav Mracek 2016-10-24 11:31:40 EDT
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).
Comment 4 Mike FABIAN 2016-10-25 01:26:57 EDT
(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)
Comment 5 Mike FABIAN 2016-10-25 01:28:12 EDT
Clear needinfo.
Comment 6 Jaroslav Mracek 2016-12-02 11:28:59 EST
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
Comment 7 Mike FABIAN 2016-12-03 08:54:39 EST
(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.
Comment 8 Mike FABIAN 2016-12-03 09:01:48 EST
(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@gmail.com>' \
  --msgid-bugs-address="$msgid_bugs_address"
Comment 9 Mike FABIAN 2016-12-03 09:03:26 EST
Maybe you need to add the -c option here?:

https://github.com/rpm-software-management/dnf/blob/master/po/CMakeLists.txt

Note You need to log in before you can comment on or make changes to this bug.