[Sugar-devel] Unicode strings in translations

S. Daniel Francis francis at sugarlabs.org
Tue Aug 14 18:48:04 EDT 2012


2012/8/14 Manuel Kaufmann <humitos at gmail.com>:
> The reason is given here:
>
> "Software should only work with Unicode strings internally, converting
> to a particular encoding on output."

As I said, the unicode (Python type what generated this thread), is
used only internally and our link gives more sense to what I say, the
output is usually coded in utf-8 (coded string).

Here the translated strings are usually:
- Simple arguments for a GtkWidet
Example:
button = ToolButton('gtk-add')
button.set_tooltip(_('Append'))

- Strings with format
Example:
button.set_tooltip(_('Append %s') % _('something'))

These strings aren't processed internally, the last string depends of
other programs and libraries implemented correctly (A part at the
Python interpreter), they will not generate a conflict if you have
only Asian characters.

The unicode type at python is used in cases when the text doesn't go
directly to the output and your code processes it directly. For
example if you have a long string and you'd like to insert line feeds
into the string. Too few strings in the Sugar Pootle are made for
this, but in the case of be needing it, there are the methods
unicode.encode and str.decode available and tidy at Python.

Regards.
~danielf


More information about the Sugar-devel mailing list