Hi, I'm trying to write a simple Hello world program in i18n form, using C... Can someone please help me? Thanks
+4
A:
Hum, let's try to make some sense out of this question :) If you use C and have gettext available, you can do:
#include <libintl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
setlocale (LC_ALL, "");
bindtextdomain ("hello", "/usr/share/locale");
textdomain ("hello");
printf (gettext ("Hello, world!\n"));
exit (0);
}
FX
2010-02-10 13:06:22
+2
A:
Have a look at the GNU Hello World program. It demonstrates a lot of good programming principles, including internationalization. From the hello
man page:
GNU Gettext (see Introduction) is used for internationalization support. Hello's greeting has been translated into many languages.
Heinzi
2010-02-10 13:07:03