[openstack-dev] _() consensus??

Monty Taylor mordred at inaugust.com
Sat Jan 5 08:49:42 UTC 2013



On 01/05/2013 03:43 AM, Zhongyue Luo wrote:
> 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.

I'm not _opposed_ to this - but I also don't think it's necessary. If
you have LANG=en_US (or something equiv) - then string translation
should not happen. I don't think tossing another cfg option at people
gets us much, no?



More information about the OpenStack-dev mailing list