Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-c / hello.c
blob20be7f3b666886cbec6351ffef450eb9e5a7a478
1 /* Example for use of GNU gettext.
2 This file is in the public domain.
4 Source code of the C program. */
7 /* Get setlocale() declaration. */
8 #include <locale.h>
10 /* Get printf() declaration. */
11 #include <stdio.h>
13 /* Get getpid() declaration. */
14 #if HAVE_UNISTD_H
15 # include <unistd.h>
16 #endif
18 /* Get gettext(), textdomain(), bindtextdomain() declaration. */
19 #include "gettext.h"
20 /* Define shortcut for gettext(). */
21 #define _(string) gettext (string)
23 int
24 main ()
26 setlocale (LC_ALL, "");
27 textdomain ("hello-c");
28 bindtextdomain ("hello-c", LOCALEDIR);
30 printf ("%s\n", _("Hello, world!"));
31 printf (_("This program is running as process number %d."), getpid ());
32 putchar ('\n');
34 return 0;