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

Re: Language Support



On Friday 13 January 2006 3:11 pm, Robbie wrote:
> That ckeared up a few things. I've discovered the GNU translation projects
> and notive they have quite an extensive way to handle translations. But for
> embedded systems that solution seem to be a memory grabber.

Not necessarily, if only the translations for the user's locale are installed, 
instead of the default of every translation.

> Is this the 
> system used for embedded systems? I've tried to set the gettext up to do a
> demo but it didn't work and I couldn't find any docs indicating what I'll
> need and some steps to atleast get some hello-world translation.

	#ifdef ENABLE_NLS
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	#endif

You can see how it works in a real program if you download from:
http://www.linux.codehelp.co.uk/embedded.html#gpeexpenses
http://www.linux.codehelp.co.uk/tarballs/
http://www.linux.codehelp.co.uk/tarballs/gpe-expenses-source-0.0.4.tar.gz

There's a po/ directory in the source and the necessary instructions in 
configure.ac to prepare it.

> I have 
> questions like What's a domain?

The program. e.g. 
http://www.iro.umontreal.ca/translation/registry.cgi?domain=pilot-qof
One program has many translations.

> What's bindtextdomain?

The program that is to be bound to the specific translation, IIRC.

> do I run xgettext  
> on the host for the platform?

? gettext needs to run on the embedded device, it's part of the startup 
sequence using the C above.
gettext also runs during the build (on the host) to identify translatable 
strings, build the pot file for creating new translations in po files, merge 
new strings into old translations and generally do most of the hard work for 
you. In most cases, once you have one translation in the source, adding 
others is simply a case of adding the code to ALL_LINGUAS in configure.ac and 
adding the .po file to CVS. Before the next release, implement a string 
freeze, prepare a new pot file, send it to the Translation Project and wait 
for the updated po files to come back before making the release.

> It seem so convoluted and maybe someone could point me to a good intro
> page, or better suggest a simple approach for embedded systems.

I presume you've tried:
http://www.gnu.org/software/gettext/manual/html_chapter/gettext_toc.html

Also:
http://www.iro.umontreal.ca/translation/HTML/gettext.html

For a hands-on guide on how to create translations of an existing program, see 
the doc/ directory in the source, e.g. gnucash has:
http://svn.gnucash.org/cgi-bin/viewcvs.cgi/gnucash/trunk/doc/README.translator.txt?rev=8592&view=markup
or
http://svn.gnucash.org/cgi-bin/viewcvs.cgi/gnucash/trunk/doc/TRANSLATION_HOWTO?rev=12249&view=markup

Apologies for the long URL's, if they don't work, I can send you these files 
by email or you can navigate from:
http://svn.gnucash.org/cgi-bin/viewcvs.cgi/gnucash/trunk/doc/
and view README.translator.txt and TRANSLATION_HOWTO from there.

-- 

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgpbCWeqgr1iD.pgp
Description: PGP signature


Reply to: