[GRASS5] i18n GRASS mechanism description

Alex Shevlakov alex at asrv.fcpf.ru
Fri Mar 1 05:49:45 EST 2002


Hi,

seems like we are ready to begin writing strings for
GRASS i18n.

To facilitate the task for those who could possibly join
this:

All I have about methods doing this work is in Russian (unfortunately).
http://www.cs.msiu.ru/projects/kurs/1999/oop/Antipov/HTML/node24.html

Here's a link to the gnu site with explanations I could not use
because I'm not Emacs user.
http://www.gnu.org/manual/gettext/html_chapter/gettext_toc.html

a brief way to create .po and .mo filez:

[user at host:somedir] xgettext -a *.c -o some_module.po

This makes a template which must be edited. Unneeded fields are removed,
those that correspond to translatable strings are translated. Don't
forget editing the header with encoding entries.

[user at host:somedir] msgfmt some_module.po -o some_module.mo

This makes the machine file (.mo). Both files would go to grass/locale/your_locale/LC_MESSAGES. That's where the prog will look for them.
If you don't put the .mo file to this directory, you'll see the
program output strings unchanged. (as if only English was there).

Now you'ready to begin changing strings
in progs to test your localization (unless someone has done it for you,
I have submitted so far g.select.pg and g.table.pg):

Add the following two line to Gmakefile:

PACKAGE = "your.module"
DEFS = -Wall -DPACKAGE=\"$(PACKAGE)\"

Add #include "glocale.h"

to all c-files with strings (corresponding to the .po files you just edited).

Add the 5 lines to main.c:

#ifdef HAVE_LIBINTL_H
  setlocale (LC_MESSAGES, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);
#endif

Now, change all the translatable strings like this:
list->description       = _("Use -l flag for list of databases.");

OR

if(list->answer) {
        printf(_("The following databases are in the Unix catalogue:\n"));

 I.e., you should change the "stringstringstring" to _("stringstringstring")

wherever you want it be translated.

Seems like this is it.

Glynn, I think of the mechanism you mentioned as basis for locale maintainers,
and it is easy to search for diffs between the templates you created last time
and now.

--alex


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20020301/3c117db6/attachment.bin


More information about the grass-dev mailing list