Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-c++ / hello.cc
blob579490eed534bf5e26d61bf4f497d1ad40a50453
1 // Example for use of GNU gettext.
2 // This file is in the public domain.
4 // Source code of the C++ program.
7 // Avoid deprecation warnings from g++ 3.1 or newer.
8 #if defined __GNUG__ && defined __DEPRECATED
9 # include <iostream>
10 using namespace std;
11 #else
12 # include <iostream.h>
13 #endif
15 // Get setlocale() declaration.
16 #include <locale.h>
18 // Get getpid() declaration.
19 #if HAVE_UNISTD_H
20 # include <unistd.h>
21 #endif
23 // Get gettext(), textdomain(), bindtextdomain() declaration.
24 #include "gettext.h"
25 // Define shortcut for gettext().
26 #define _(string) gettext (string)
28 // Get autosprintf class declaration.
29 #include "autosprintf.h"
30 using gnu::autosprintf;
32 int
33 main ()
35 setlocale (LC_ALL, "");
36 textdomain ("hello-c++");
37 bindtextdomain ("hello-c++", LOCALEDIR);
39 cout << _("Hello, world!") << endl;
40 cout << autosprintf (_("This program is running as process number %d."),
41 getpid ())
42 << endl;