Bug 461824 - yum should use ngettext
Summary: yum should use ngettext
Keywords:
Status: CLOSED DUPLICATE of bug 552317
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-10 20:29 UTC by Miloš Komarčević
Modified: 2014-01-21 23:06 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-04-29 16:31:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch for ngettext use in yum (3.22 KB, patch)
2008-11-02 01:49 UTC, Miloš Komarčević
no flags Details | Diff
Patch for ngettext use in yum, ver 2 (5.03 KB, patch)
2008-11-04 23:25 UTC, Miloš Komarčević
no flags Details | Diff

Description Miloš Komarčević 2008-09-10 20:29:06 UTC
ngettext should be used on strings containing plurals such as "%d packages marked for Update", as not all languages follow English plural rules.

For more details, please see e.g. http://live.gnome.org/TranslationProject/DevGuidelines/Plurals

Comment 1 Tim Lauridsen 2008-11-01 10:00:58 UTC
I agree ngettext would be a good idea, but a lot of strings need to be split up in more pieces, so patches is always welcome :)

Comment 2 Miloš Komarčević 2008-11-02 01:49:00 UTC
Tim, I cannot see which strings would need to be split, can you provide an example?

I'm attaching a patch as a starting point for using ngettext with yum.

Disclaimer: never coded in Python, so don't know if this at all correct. E.g. you might want to alias t.ungettext() in yum/i18n.py and provide some sort of a dummy wrapper just like for _().

Comment 3 Miloš Komarčević 2008-11-02 01:49:42 UTC
Created attachment 322201 [details]
Patch for ngettext use in yum

Comment 4 James Antill 2008-11-03 04:42:11 UTC
 Did you test that? Where is t bound? Isn't N_() the common name for ngettext in C/etc?

 Due to yum being an API as well as a command, we can't put names into the global scope.
 Also how did you find those spots to change? As it doesn't look complete to me.
 If it was just searching for %d then you need to also look for usage like in listTransaction which does:

_("""
Transaction Summary
%s
Install  %5.5s Package(s)         
Update   %5.5s Package(s)         
Remove   %5.5s Package(s)         
""")

Comment 5 Miloš Komarčević 2008-11-03 11:12:08 UTC
James, as mentioned, I haven't coded in Python at all before, so this is unfortunately untested, that's why I said it's only a starting point ;)

You're right, I did search only for %d, so I now see the need to split up more complicated cases like the one above.

As far as the aliases are concerned, i think N_() is traditionally used for gettext_noop() (i.e. just returning the untranslated string, both in C and other languages [1]), but I've seen P_() for aliasing ngettext in C header files. 

t is bound in yum/i18n.py, so I presume the ngettext alias and its dummy should go in there...

I'll try to pool some translators on the list, maybe someone knows a bit more Python so we can test this first and send a more suitable patch.

[1] http://docs.python.org/library/gettext.html#deferred-translations

Comment 6 Miloš Komarčević 2008-11-04 23:23:47 UTC
Here's a second go, hope it's more formal.

Still to do, hopefully by someone more knowledgeable:

- intltool love (need to pass --keyword=P_:1,2 to xgettext somehow; a brief search suggests XGETTEXT_OPTIONS in po/Makevars or XGETTEXT_KEYWORDS in po/Makefile.in.in) so we can extract these properly in the pot file

- splitting the one outstanding string mentioned above

- removing po/pygettext.py (obsolete, doesn't even support ngettext), clean up POTFILES.skip (see e.g. notices http://translate.fedoraproject.org/module/yum)

Comment 7 Miloš Komarčević 2008-11-04 23:25:24 UTC
Created attachment 322500 [details]
Patch for ngettext use in yum, ver 2

Comment 8 Bug Zapper 2008-11-26 03:01:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 9 James Antill 2009-03-06 20:02:16 UTC
Ok I added P_ as infrastructure in commit e1931cfcfe9e97062f1291e15b0c5a02752ed282.

We can add the messages when we get the Makefile stuff etc. too.

Comment 10 James Antill 2010-04-29 16:31:10 UTC
I think the code is there now, someone just has to go through and add all the P_() stuff. So closing this as a dup of the RFE for plural forms text.

*** This bug has been marked as a duplicate of bug 552317 ***


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