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