Bug 1386078 - L10N - Explain repoquery strings
Summary: L10N - Explain repoquery strings
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-18 05:29 UTC by jibecfed
Modified: 2017-06-14 14:38 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-14 14:38:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description jibecfed 2016-10-18 05:29:48 UTC
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 11:15:17 UTC
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 13:14:12 UTC
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 15:31:40 UTC
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 05:26:57 UTC
(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 05:28:12 UTC
Clear needinfo.

Comment 6 Jaroslav Mracek 2016-12-02 16:28:59 UTC
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 13:54:39 UTC
(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 14:01:48 UTC
(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"

Comment 9 Mike FABIAN 2016-12-03 14:03:26 UTC
Maybe you need to add the -c option here?:

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

Comment 10 Jaroslav Mracek 2017-06-14 14:38:23 UTC
The patch was released in dnf-2.0.0-1 into rawhide and fc26.


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