Bug 461824
Summary: | yum should use ngettext | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Miloš Komarčević <kmilos> | ||||||
Component: | yum | Assignee: | Seth Vidal <skvidal> | ||||||
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | rawhide | CC: | ffesti, james.antill, piotrdrag, pmatilai, tim.lauridsen | ||||||
Target Milestone: | --- | Keywords: | FutureFeature | ||||||
Target Release: | --- | ||||||||
Hardware: | All | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Enhancement | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2010-04-29 16:31:10 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
Miloš Komarčević
2008-09-10 20:29:06 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 :) 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 _(). Created attachment 322201 [details]
Patch for ngettext use in yum
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) """) 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 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) Created attachment 322500 [details]
Patch for ngettext use in yum, ver 2
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 Ok I added P_ as infrastructure in commit e1931cfcfe9e97062f1291e15b0c5a02752ed282. We can add the messages when we get the Makefile stuff etc. too. 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 *** |