[Yum-devel] [PATCH] Make the source xgettext-friendly.
tim.lauridsen at gmail.com
tim.lauridsen at gmail.com
Fri Jun 24 06:37:36 UTC 2011
2011/6/23 Zdeněk Pavlas <zpavlas at redhat.com>:
> xgettext ignores _(var), so localize literals instead.
> ---
> output.py | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/output.py b/output.py
> index c146abf..b6aa277 100755
> --- a/output.py
> +++ b/output.py
> @@ -1103,14 +1103,14 @@ Transaction Summary
> %s
> """) % ('=' * self.term.columns))
> for action, count in (
> - ('Install', len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
> - ('Upgrade', len(self.tsInfo.updated) + len(self.tsInfo.depupdated)),
> - ('Remove', len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
> - ('Reinstall', len(self.tsInfo.reinstalled)),
> - ('Downgrade', len(self.tsInfo.downgraded)),
> + (_('Install'), len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
> + (_('Upgrade'), len(self.tsInfo.updated) + len(self.tsInfo.depupdated)),
> + (_('Remove'), len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
> + (_('Reinstall'), len(self.tsInfo.reinstalled)),
> + (_('Downgrade'), len(self.tsInfo.downgraded)),
> ):
> if count: out.append('%-9s %5d %s\n' % (
> - _(action), count, P_('Package', 'Packages', count),
> + action, count, P_('Package', 'Packages', count),
> ))
> return ''.join(out)
>
> --
> 1.7.4.4
>
> _______________________________________________
> Yum-devel mailing list
> Yum-devel at lists.baseurl.org
> http://lists.baseurl.org/mailman/listinfo/yum-devel
>
I think we have to rethink this a little, splitting up a string is bad
for translation, because the translator can change the order of the
words
and cant see the context of the single strings.
We need to have a dictionary with the whole sentence in both plural forms.
Something like this.
STRINGS = {
"install" : [_("Installed %5d package"),_("Installed %5d packages")]
...
}
for action, count in (
('Install', len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
...
if count: out.append('%s\n' % (
STRINGS[action], count),
))
return ''.join(out)
In this way the translates can see the whole sentence, and change
placement of %5d
In danish
"Installed %5d package would be "%5d pakke installeret"
Tim
More information about the Yum-devel
mailing list