"RJ" == Ron Jarrell <jarrell@vt.edu> writes:
RJ> Jeez, Barry, that itty-bitty change you made last night to not
RJ> import _ into the namespace by default broke a *lot* of
RJ> things...
I did that on purpose! :) Explicit is better than implicit.
"TW" == Thomas Wouters <thomas@xs4all.net> writes:
TW> It's probably safe to assume that anything that imports
TW> gettext needs to be modified to import _ explicitly, but I'll
TW> let Barry draw that conclusion :-)
Actually, Mailman.i18n._() tries to improve on gettext._ by adding the new sys._getframe() hack to make the marked strings more succinct. In other words, where you'd have to write (using gettext as _):
_('The list %(listname)s has %(membercnt)s non-digest members' %
{'listname' : mlist.real_name(),
'membercnt': count_of_non_digest_members(mlist),
})
You can now write:
listname = mlist.real_name()
membercnt = count_of_non_digest_members(mlist)
_('The list %(listname)s has %(membercnt)s non-digest members')
You have to use string-dict interpolation because the order of words may be different in different languages. But it seems ridiculous to have to write the varnames twice as in the first example (the second looks worse than it is in practice, because usually the variables you want to interpolate into the string are already present as local variables or arguments).
Most modules therefore will "from Mailman.i18n import _" but Errors.py skips the from...import style to avoid circular imports.
BTW, thanks for the patch Ron. I've just applied it and will now review it, but checking in the changes may have to wait. Seems SF is refusing my ssh pubkey at the moment.
-Barry