[Sugar-devel] [PATCH 2/5] sl#2815: Localization fixes.

Gonzalo Odiard gonzalo at laptop.org
Fri Jan 20 08:31:54 EST 2012


The problem is the substitution of a single string to translate here:
                secondary_text = _(*'%(hour)d:%(min).2d remaining'*) % \
                        {'hour': remaining_hourpart, 'min':
remaining_minpart}

by a concatenation here:
                time_value = '%(hour)d:%(min).2d ' % \
                        {'hour': remaining_hourpart, 'min':
remaining_minpart}
                secondary_text = *time_value + _('remaining')

*The string to translate should be one, the the translator can reorder as
needed.

But the bug say "This string could use a developers comment clarifying what
gets translated.
It is often done incorrectly in our Pootle instance."

I think he refer to add a line as:

# TRANS: Remaining battery time.

This comment will be used by gettext and displayed in the pootle server to
help the translators

You can see one example here:
http://git.sugarlabs.org/sugar/mainline/blobs/master/extensions/cpsection/updater/view.py#line381

I am copying to Chris to confirm if this was the intention of the bug
filled.

Gonzalo

On Fri, Jan 20, 2012 at 3:37 AM, Ajay Garg <ajay at activitycentral.com> wrote:

> Ahh,, that's an interesting scenario ...
>
> So, what could be the solution ??!! ; may be re-phrase the information as
> ::
>                      Time remaining : 1:46
>
> instead of
>                      1:46 remaining
>
> In this, "Time remaining" could be localized, while "1:46" will be a mere
> value.
>
>
> *However, the question pops up - how to handle Right-To-Left languages
> then* ?
>
> I will be grateful if someone could enlighten the way to go about in such
> cases.
>
>
> Regards,
> Ajay
>
>
>
>
> On Fri, Jan 20, 2012 at 8:37 AM, Gonzalo Odiard <gonzalo at laptop.org>
> wrote:
> > This patch does not solve the bug and introduce a new l10n problem.
> > You put the 'remaining' string at the end, and can exist languages where
> > should be in different order.
> >
> > Gonzalo
> >
> > On Thu, Jan 19, 2012 at 6:35 PM, Ajay Garg <ajay at activitycentral.com>
> wrote:
> >>
> >> Signed-off-by: Ajay Garg <ajay at activitycentral.com>
> >> ---
> >>  extensions/deviceicon/battery.py |    3 ++-
> >>  1 files changed, 2 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/extensions/deviceicon/battery.py
> >> b/extensions/deviceicon/battery.py
> >> index 260cb12..63530fe 100644
> >> --- a/extensions/deviceicon/battery.py
> >> +++ b/extensions/deviceicon/battery.py
> >> @@ -155,8 +155,9 @@ class BatteryPalette(Palette):
> >>                 minutes_remaining = self._time // 60
> >>                 remaining_hourpart = minutes_remaining // 60
> >>                 remaining_minpart = minutes_remaining % 60
> >> -                secondary_text = _('%(hour)d:%(min).2d remaining') % \
> >> +                time_value = '%(hour)d:%(min).2d ' % \
> >>                         {'hour': remaining_hourpart, 'min':
> >> remaining_minpart}
> >> +                secondary_text = time_value + _('remaining')
> >>         else:
> >>             secondary_text = _('Charged')
> >>
> >> --
> >> 1.7.4.4
> >>
> >> _______________________________________________
> >> Sugar-devel mailing list
> >> Sugar-devel at lists.sugarlabs.org
> >> http://lists.sugarlabs.org/listinfo/sugar-devel
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120120/dc376995/attachment.html>


More information about the Sugar-devel mailing list