[openstack-dev] _() consensus??

Zhongyue Luo zhongyue.nah at intel.com
Sat Jan 5 08:43:17 UTC 2013


Hi all,

I understand that i18n is an important feature to customers and that having
gettextutils wrapped on all log messages will benefit
in packing custom .pot files to ship with a product.

However seeing the number of _()'s increasing in source code, its now kind
of bothering me now to see all the messages go through
the heavy process of gettext.translation() even when I don't need i18n.

Therefore I propose a flag, e.g i18n=true|false, so that a developer can
choose the behavior of the _().

in openstack.common.gettextutils.py...

def _(msg):
   if cfg.CONF.i18n:
       return t.ugettext(msg)
   else:
       return msg

Well you can have the if/else outside of the function to prevent looking up
the conf every time it gets called but you get the idea.

Any thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130105/0dc4b6ad/attachment.html>


More information about the OpenStack-dev mailing list