Thanks Gonzalo. Thanks Chris. I think I understood the mechanism:
In the i18n file, the "key" string will be "%(hour)d %(min).2d remaining". The translation needs to be done, with the understanding that the tokens "%(hour)d", "%(min).2d" and "remaining" might be inter-located, however the information needs to be conveyed that argument-formatter tokens should not be translated, only the string tokens. That information should be conveyed by the "TRANS" label, which gets copied "as-it-is" in the i18n file. Thanks. Just one more question, can the "TRANS" label string span multiple lines? That is, is something like :: # TRANS: first line text # second line text # third line text correct? or it needs to be :: # TRANS: first line text second line text third line text Looking forward to a reply. Regards, Ajay On Fri, Jan 20, 2012 at 7:23 PM, Chris Leonard <cjlhomeaddr...@gmail.com>wrote: > On Fri, Jan 20, 2012 at 8:31 AM, Gonzalo Odiard <gonz...@laptop.org> > wrote: > > 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. > > I agree with Gonzalo, any concatenation is very bad i18n practice. A > complete phrase can be properly translated to conform to the syntax of > any language. I do not believe there is a need to change the string > itself, I would leave it as is. > > > > > 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. > > I would probably suggest > > # TRANS: do not translate %(hour)d:%(min).2d it is a variable, only > translate the word "remaining" > > What I commonly see is the local words for hour and minute inserted in > the variable, causing a printf error, whcih will break a software > build. > > > > > 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 >
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel