[openstack-dev] _() consensus??

Mark McLoughlin markmc at redhat.com
Mon Jan 7 08:16:24 UTC 2013


On Mon, 2013-01-07 at 15:58 +0800, Xu He Jie wrote:
> On 2013年01月07日 15:27, Mark McLoughlin wrote:
> > On Sat, 2013-01-05 at 16:43 +0800, 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.
> > If we want to i18n log messages, I think they should be in a separate
> > translation domain from the messages we return to users of the REST API.
> >
> > The problem with having them both in the same translation domain is that
> > translators have no way of prioritizing the REST API messages nor do
> > administrators have any way of disabling the translation of log messages
> > without the translation of the REST API messages.
> >
> > Something like this:
> >
> >    import gettext
> >
> >    gettext.install('nova', unicode=True)
> >    t = gettext.translation('nova-logmsgs', fallback=True)
> >
> >    import __builtin__
> >    __builtin__.__dict__['L_'] = t.ugettext
> >
> >    print _('This is a user-visible message')
> User-visible message's translation domain should be decided by user's 
> locale.
> If we wrapped message with '_()', those message will be translated as
> server side locale.
> 
> So we should remove all '_()' from exception message and we should find 
> a way for
> get user locale from user's request and translated it.

That's a very good point. Care to file a bug on that?

It still makes sense to have REST API messages and log messages be in
separate translation domains, though.

Cheers,
Mark.




More information about the OpenStack-dev mailing list