Fwd: [GRASS-dev] Scripting in Linux

Glynn Clements glynn at gclements.plus.com
Wed Jan 27 12:47:36 EST 2010


Kim Besson wrote:

> This might have something to do with a few messages related with i.tasscap
> translation.
> 
> Ok (I have tested this at my WinGRASS installation due to limit access to my
> LINUX machine):
> 1- I downloaded grassmods_es.po file (the first language where I want to
> have my NDVI calculator available). Other will be Brazilian and of course
> English (already available in the Script code).
> 2- Just like Glynn said, At the po file header is some
> information: "Content-Type: text/plain; charset=ISO-8859-1\n"
> 3- At grassmods.mo the following was there:
> #: ../locale/scriptstrings/i.tasscap_to_translate.c:1
> msgid "Tasseled Cap (Kauth Thomas) transformation for LANDSAT-TM data"
> msgstr "Transformación Tasseled Cap (Kauth Thomas) para datos LANDSAT-TM"
> 4- using po Editor I created mo files and renamed and put them in
> location/es/LC_Messages
> 4- I added the following to my Init.bat
> set LANGUAGE=es_ES
> set LANG=es_ES
> set LC_ALL=es_ES
> 5- I Started GRASS and realize that:
> - GUI is in spanish (bueno :) buttons, text in status bar in the bottom;
> menu
> - But i.tasscap and neither other scripts are translated even If I have them
> in my mo file.
> 6- I decided to compare the type of files I mean, wxpython_es.po that is
> working againts grassmods_es.po that isn't.

Ensure that GRASS was configured with the --with-nls flag, otherwise
it won't use translations. The wxPython GUI will use translations
regardless of how GRASS was configured.

> Conclusions: The one that is working is  UTF-8
> and Content-Transfer-Encoding: 8bit\n and the other one
> is charset=ISO-8859-1.
> 
> Is this the problem? If it's how can we contour this problem, I mean use
> special characters? (I also experiment with De and it also didnt' work).

The encoding of the .po file isn't "visible" to the code which uses
the translations. The .mo file will always contain UTF-8 text, but
this is automatically converted to the locale's encoding when the
translation is retrieved.

In 6.4, there is (or was?) a known bug with the GUI and non-UTF-8
locales: the GUI converts the text from the locale's encoding to
UTF-8, but leaves the original encoding in the XML header, which can
confuse the XML parser. But this depends upon the locale's encoding,
not the encoding of the .po file.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list