[Sugar-devel] Unicode strings in translations
S. Daniel Francis
francis at sugarlabs.org
Tue Aug 14 17:18:32 EDT 2012
2012/8/14 Gonzalo Odiard <gonzalo at laptop.org>:
>>
>> Unicode (Python Type) is for process text, but for input/output, that
>> text will need to be encoded as a string, and for that you will need a
>> code charset. Now it's the time to ask: Must we get all the translated
>> strings as Unicode and encode them as utf-8? I think there are too few
>> cases when an activity gets translated strings and needs to work
>> directly with unicode.
>
>
> Probably because you do not speak chinese or any other asian language.... :)
>
We can represent all unicode characters in utf-8 and that's one of the
reasons Linux has it by default, of course the translations are
encoded in utf-8 because it can represent characters from Asia,
Africa, languages with derivation from Latin and non-existent
languages.
Now the question is: Why should we get translations as Python type
Unicode and encode them again in utf-8?
We have our translations encoded in files. The activity can get the
strings directly for output, but if the activity will modify or only
iterate a string, it's recommended to decode the utf-8 string and work
with the text in the Python type Unicode and then encode it as a utf-8
string for use it as output. What Manuel is purposing, is setup
gettext appropriately for get text of type unicode with the _
function. A big part of the translated strings don't need that step of
encode and decode...
~danielf
More information about the Sugar-devel
mailing list