1 /* Example for use of GNU gettext. 2 This file is in the public domain. 3 4 Source code of the C program. */ 5 6 7 /* Get setlocale() declaration. */ 8 #include <locale.h> 9 10 /* Get printf() declaration. */ 11 #include <stdio.h> 12 13 /* Get getpid() declaration. */ 14 #if HAVE_UNISTD_H 15 # include <unistd.h> 16 #endif 17 18 /* Get gettext(), textdomain(), bindtextdomain() declaration. */ 19 #include "gettext.h" 20 /* Define shortcut for gettext(). */ 21 #define _(string) gettext (string) 22 23 int main()24main () 25 { 26 setlocale (LC_ALL, ""); 27 textdomain ("hello-c"); 28 bindtextdomain ("hello-c", LOCALEDIR); 29 30 printf ("%s\n", _("Hello, world!")); 31 printf (_("This program is running as process number %d."), getpid ()); 32 putchar ('\n'); 33 34 return 0; 35 } 36