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

Anne Mulhern amulhern at redhat.com
Wed Nov 12 13:42:25 UTC 2014





----- 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 ""

?


More information about the anaconda-patches mailing list