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 defined _WIN32 && !defined __CYGWIN__
15 /* native Windows API */
16 # include <process.h>
17 # define getpid _getpid
18 #else
19 /* POSIX API */
20 # include <unistd.h>
21 #endif
22
23 /* Get gettext(), textdomain(), bindtextdomain() declaration. */
24 #include "gettext.h"
25 /* Define shortcut for gettext(). */
26 #define _(string) gettext (string)
27
28 int
29 main ()
30 {
31 setlocale (LC_ALL, "");
32 textdomain ("hello-c");
33 bindtextdomain ("hello-c", LOCALEDIR);
34
35 printf ("%s\n", _("Hello, world!"));
36 printf (_("This program is running as process number %d."), getpid ());
37 putchar ('\n');
38
39 return 0;
40 }