[Sugar-devel] [PATCH sugar-toolkit-gtk3] Use class-based API for gettext translations

Manuel Kaufmann humitos at gmail.com
Tue Aug 14 15:15:24 EDT 2012


On Tue, Aug 14, 2012 at 3:49 PM, Gonzalo Odiard <gonzalo at laptop.org> wrote:
> Can you explain the problem you are trying to solve and
> why you think this is the right solution?

I sent an email yesterday commenting what the problem is and what the
best solution is. Here is the thread:

 * http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038928.html

Broadly speaking, the issue is related with "merging Unicode string
with 8bits ones" and this convey many problems that are difficult to
find out and solve. In Python, is highly recommended to use Unicode
throughout the source code and encode the string when it is necessary.
For example, when you want to save some text into a file or send data
through internet (via HTTP POST).

With this patch there is no need to change the source code of all the
activities, they should work as they are. But, we can omit the import
of gettext as _ because this patch installs it as a builtin
function[1]:

from gettext import gettext as _

For this reason, we can omit this line in new Activities.

Is it clearer now?

Thanks,

[1] http://docs.python.org/library/gettext.html#gettext.install

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/


More information about the Sugar-devel mailing list