No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / examples / hello-c++ / hello.cc
blob18ba81e64579fdd19db20cfb265bfc05514842fd
1 // Example for use of GNU gettext.
2 // Copyright (C) 2003 Free Software Foundation, Inc.
3 // This file is in the public domain.
5 // Source code of the C++ program.
8 // Avoid deprecation warnings from g++ 3.1 or newer.
9 #if defined __GNUG__ && defined __DEPRECATED
10 # include <iostream>
11 using namespace std;
12 #else
13 # include <iostream.h>
14 #endif
16 // Get setlocale() declaration.
17 #include <locale.h>
19 // Get getpid() declaration.
20 #if HAVE_UNISTD_H
21 # include <unistd.h>
22 #endif
24 // Get gettext(), textdomain(), bindtextdomain() declaration.
25 #include "gettext.h"
26 // Define shortcut for gettext().
27 #define _(string) gettext (string)
29 // Get autosprintf class declaration.
30 #include "autosprintf.h"
31 using gnu::autosprintf;
33 int
34 main ()
36 setlocale (LC_ALL, "");
37 textdomain ("hello-c++");
38 bindtextdomain ("hello-c++", LOCALEDIR);
40 cout << _("Hello, world!") << endl;
41 cout << autosprintf (_("This program is running as process number %d."),
42 getpid ())
43 << endl;