Re: translation



Franck Martin wrote:

/Sorry// to post here, but it is a little bit devlopment too.../

I'm looking into translating gnome in Fijian. I found the .pot files from the gtp adn an nice tool for translation gtranslator...

However how gettext work? Is the translation happen at compile time, or at execution time gettext will load the correct file depending of the locale?

And I haven't found yet information on the format of the LC_MONETARY and other files?

gnome-i18n gnome org would probably be a good list to ask questions like this.

Here is a short rundown of how an app is internationalised:

  1. app author goes through the program and finds strings that need to
     be translated.  Strings like "foo" would get changed to
     gettext("foo") or _("foo") (most programs using gettext define _()
     to be the same as gettext()).
  2. The xgettext script is run over the source files of the program to
     create a po file template from all strings marked with gettext()
     or _().
  3. Translators take a copy of the po template and add all the
     localised strings to create their locale's po file.
  4. The po files are compiled to .mo files (which are essentially
     serialised hash tables mapping original string -> translated
     string), and installed with the rest of the program.
  5. At runtime, the .mo file for the user's locale is loaded, and used
     by the gettext() function to translate the original strings to the
     localised strings.

These days, most app authors do step 1 while writing the app. Steps 2 and 4 are handled by the standard po/Makefile script.

As for things like the LC_MONETARY file, these are shipped with glibc, rather than GNOME.

James.

--
Email: james daa com au              | Linux.conf.au   http://linux.conf.au/
WWW: http://www.daa.com.au/~james/ | Jan 22-25 Perth, Western Australia.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]