Problem with mixing doctest with gettext _()
Skip Montanaro
skip at pobox.com
Fri Feb 27 09:56:16 EST 2004
>> I suspect it's because your dummy _ is not in builtins. Why not just
>> call gettext.install() where you are currently defining _?
Pierre> Skip, this looks like the way to go.
Pierre> I was trying to avoid it because the translation files for these
Pierre> library modules are constructed at the application level
Pierre> somewhere else. But I was also considering creating a
Pierre> translation library for these module, so I guess that is one
Pierre> more incentive to do so...
If you really want a dummy _() you can also stuff your version into
builtins:
>>> import __builtin__
>>> def foo(s): return s
...
>>> __builtin__._ = foo
>>> _
<function foo at 0x1d6670>
>>> _("hi")
'hi'
Skip
More information about the Python-list
mailing list