• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/gettext-0.17/gettext-tools/examples/hello-c++/
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// Avoid deprecation warnings from g++ 3.1 or newer.
8#if defined __GNUG__ && defined __DEPRECATED
9# include <iostream>
10using namespace std;
11#else
12# include <iostream.h>
13#endif
14
15// Get setlocale() declaration.
16#include <locale.h>
17
18// Get getpid() declaration.
19#if HAVE_UNISTD_H
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// Get autosprintf class declaration.
29#include "autosprintf.h"
30using gnu::autosprintf;
31
32int
33main ()
34{
35  setlocale (LC_ALL, "");
36  textdomain ("hello-c++");
37  bindtextdomain ("hello-c++", LOCALEDIR);
38
39  cout << _("Hello, world!") << endl;
40  cout << autosprintf (_("This program is running as process number %d."),
41                       getpid ())
42       << endl;
43}
44