[Sugar-devel] [PATCH] sl#3149: Localization fixes.

Simon Schampijer simon at schampijer.de
Thu Feb 9 04:18:44 EST 2012


On 01/23/2012 02:48 PM, Ajay Garg wrote:
> ---
>
> Removed unncessary "gettext" notations; plus added "TRANS" labels for not
> translating format-specifier tokens.
>
> Thanks Chris Leonard.
>
>   extensions/cpsection/aboutcomputer/model.py |    2 +-
>   src/jarabe/desktop/favoritesview.py         |    2 +-
>   src/jarabe/frame/activitiestray.py          |    7 +++++--
>   3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py
> index 431c9c0..86d2e3f 100644
> --- a/extensions/cpsection/aboutcomputer/model.py
> +++ b/extensions/cpsection/aboutcomputer/model.py
> @@ -180,7 +180,7 @@ def get_wireless_firmware():
>       if len(firmware_info) == 1:
>           return firmware_info.values()[0]
>
> -    return ', '.join([_('%(interface)s: %(version)s') %
> +    return ', '.join(['%(interface)s: %(version)s' %
>                         {'interface': interface, 'version': version}
>                         for interface, version in firmware_info.items()])

This one looks good.

> diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
> index 132d14f..5c76cdc 100644
> --- a/src/jarabe/desktop/favoritesview.py
> +++ b/src/jarabe/desktop/favoritesview.py
> @@ -336,7 +336,7 @@ class FavoritesView(hippo.Canvas):
>               schoolserver.register_laptop()
>           except RegisterError, e:
>               alert.props.title = _('Registration Failed')
> -            alert.props.msg = _('%s') % e
> +            alert.props.msg = '%s' % e
>           else:
>               alert.props.title = _('Registration Successful')
>               alert.props.msg = _('You are now registered ' \

This one looks good as well.

> diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
> index 941b174..2b8b7c6 100644
> --- a/src/jarabe/frame/activitiestray.py
> +++ b/src/jarabe/frame/activitiestray.py
> @@ -541,6 +541,7 @@ class BaseTransferPalette(Palette):
>           transferred = self._format_size(
>                   self.file_transfer.props.transferred_bytes)
>           total = self._format_size(self.file_transfer.file_size)
> +        # TRANS: do not translate the two "%s".
>           self.progress_label.props.label = _('%s of %s') % (transferred, total)

If I would add a comment here I would be verbose about the context. For 
example:

# TRANS: file transfer, bytes transferred, e.g. 128 of 1024

> @@ -555,6 +556,7 @@ class IncomingTransferPalette(BaseTransferPalette):
>           self.file_transfer.connect('notify::state', self.__notify_state_cb)
>
>           nick = str(self.file_transfer.buddy.props.nick)
> +        # TRANS: do not translate the token "%s".
>           label = glib.markup_escape_text(_('Transfer from %s') % (nick,))
>           self.props.secondary_text = label

No need to add an extra trans information here. I think translators know 
how to deal with this one.

> @@ -589,7 +591,7 @@ class IncomingTransferPalette(BaseTransferPalette):
>               type_description = mime.get_mime_description(mime_type)
>
>               size = self._format_size(self.file_transfer.file_size)
> -            label = gtk.Label(_('%s (%s)') % (size, type_description))
> +            label = gtk.Label('%s (%s)' % (size, type_description))
>               vbox.add(label)
>               label.show()

This one looks good.

> @@ -688,6 +690,7 @@ class OutgoingTransferPalette(BaseTransferPalette):
>           self.file_transfer.connect('notify::state', self.__notify_state_cb)
>
>           nick = str(file_transfer.buddy.props.nick)
> +        # TRANS: do not translate "%s".
>           label = glib.markup_escape_text(_('Transfer to %s') % (nick,))
>           self.props.secondary_text = label

Same as above: No need to add an extra trans information here. I think 
translators know how to deal with this one.

> @@ -719,7 +722,7 @@ class OutgoingTransferPalette(BaseTransferPalette):
>               type_description = mime.get_mime_description(mime_type)
>
>               size = self._format_size(self.file_transfer.file_size)
> -            label = gtk.Label(_('%s (%s)') % (size, type_description))
> +            label = gtk.Label('%s (%s)' % (size, type_description))
>               vbox.add(label)
>               label.show()

This one looks good.

Regards,
    Simon


More information about the Sugar-devel mailing list