[PATCH] Do not translate empty strings, gettext translates them into system information (basically PO file header)

Vratislav Podzimek vpodzime at redhat.com
Wed Nov 12 13:46:23 UTC 2014


On Wed, 2014-11-12 at 08:42 -0500, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Vojtech Trefny" <vtrefny at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Wednesday, November 12, 2014 8:06:17 AM
> > Subject: [PATCH] Do not translate empty strings,	gettext translates them into system information (basically PO file
> > 	header)
> > 
> > ---
> >  blivet/i18n.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/blivet/i18n.py b/blivet/i18n.py
> > index 1f07266..2f033bf 100644
> > --- a/blivet/i18n.py
> > +++ b/blivet/i18n.py
> > @@ -45,8 +45,8 @@ N_ = lambda x: x
> >  # evaluated on every call.
> >  # pylint: disable=unnecessary-lambda
> >  if six.PY2:
> > -    _ = lambda x: _get_translations().ugettext(x)
> > +    _ = lambda x: _get_translations().ugettext(x) if x else ""
> >      P_ = lambda x, y, z: _get_translations().ungettext(x, y, z)
> >  else:
> > -    _ = lambda x: _get_translations().gettext(x)
> > +    _ = lambda x: _get_translations().gettext(x) if x else ""
> >      P_ = lambda x, y, z: _get_translations().ngettext(x, y, z)
> > --
> > 2.1.0
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> Can you make these explicitly check whether value to be translated is
> empty string, as
> 
> _ = lambda x: _get_translations().gettext(x) if x == "" else ""
> 
> ?
I think it won't make a difference:
"""""
In [2]: i18n._(None)

"""""

so None is translated to "" anyway. Or is there something I'm
overlooking? If yes, we should change this in pyanaconda/i18n.py too.

-- 
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic




More information about the anaconda-patches mailing list