[Yum-devel] yum.i18n issues

James Antill james.antill at redhat.com
Mon May 5 20:20:05 UTC 2008


On Mon, 2008-05-05 at 15:53 -0400, Luke Macken wrote:
> Hey,
> 
> So I recently ran into a problem with some test cases for another project, caused
> by yum overriding the builtin '_' and replacing it with the yum.i18n.dummy_wrapper.
> One of the libraries I am using then tried to pass a 'domain' argument to
> '_', thus triggering an exception, since the dummy_wrapper does not take
> any arguments.
> 
> The yum.i18n module runs gettext.translation.install(), which ideally
> should only be used for applications[0], not modules[1].
> 
> So, a potential solution would be to define '_' in the i18n module,
> by doing something like this:
> 
>     t = gettext.translation('yum', fallback=True)
>     _ = t.ugettext
> 
> And import '_' from it where necessary.
> 
> What do you guys think?

 So that's how we had the code for a while, the big reason we changed
from that is that we wanted to be able to turn gettext off from within
the yum API (this was when unicode was causing _lots_ of problems, due
to stdout's error handler).
 Assuming that:

 i18n._ = i18n.dummy_wrapper

...works[1] fine from within __init__.py ... I think it's fine to change
it back.
 Oh, and also make sure that test/yum-release-i18n-test.sh works after
that change is installed on the running system ... just to be sure.


[1] Read: Changes what _() does for everything that's imported _ from
yum.i18n ... I'd guess this would happen, but I haven't tested it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20080505/4b45696b/attachment.pgp 


More information about the Yum-devel mailing list