gettext

In case gettext does not work on Debian systems, have a look at /etc/locale.alias and add the according language (e.g. en_US en_US.ISO-8859-1)

add gettext support to a C program

First you have to prepare the program by adding

#include <libintl.h>
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop(String)

First create a directory ./po in the source directory to hold all the gettext files. Then run the command

$ xgettext -p ./po -o messages.po --language=C --indent --width=80 --keyword=_ *.c

After that is done, a translation can be created like this:

$ cd ./po
$ msgmerge de_DE.po messages.po > de_DE_new.po
$ msgfmt --check --statistics de_DE.po --output=de_DE.mo
 
harry/gettext.txt · Last modified: 2005/04/20 15:37 (external edit)
Locations of visitors to this page

 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki