• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@c This file is part of the GNU gettext manual.
2@c Copyright (C) 1995-2020 Free Software Foundation, Inc.
3@c See the file gettext.texi for copying conditions.
4
5@node C
6@subsection C, C++, Objective C
7@cindex C and C-like languages
8
9@table @asis
10@item RPMs
11gcc, gpp, gobjc, glibc, gettext
12
13@item Ubuntu packages
14gcc, g++, gobjc, libc6-dev, libasprintf-dev
15
16@item File extension
17For C: @code{c}, @code{h}.
18@*For C++: @code{C}, @code{c++}, @code{cc}, @code{cxx}, @code{cpp}, @code{hpp}.
19@*For Objective C: @code{m}.
20
21@item String syntax
22@code{"abc"}
23
24@item gettext shorthand
25@code{_("abc")}
26
27@item gettext/ngettext functions
28@code{gettext}, @code{dgettext}, @code{dcgettext}, @code{ngettext},
29@code{dngettext}, @code{dcngettext}
30
31@item textdomain
32@code{textdomain} function
33
34@item bindtextdomain
35@code{bindtextdomain} and @code{wbindtextdomain} functions
36
37@item setlocale
38Programmer must call @code{setlocale (LC_ALL, "")}
39
40@item Prerequisite
41@code{#include <libintl.h>}
42@*@code{#include <locale.h>}
43@*@code{#define _(string) gettext (string)}
44
45@item Use or emulate GNU gettext
46Use
47
48@item Extractor
49@code{xgettext -k_}
50
51@item Formatting with positions
52@code{fprintf "%2$d %1$d"}
53@*In C++: @code{autosprintf "%2$d %1$d"}
54(@pxref{Top, , Introduction, autosprintf, GNU autosprintf})
55
56@item Portability
57autoconf (gettext.m4) and #if ENABLE_NLS
58
59@item po-mode marking
60yes
61@end table
62
63The following examples are available in the @file{examples} directory:
64@code{hello-c}, @code{hello-c-gnome}, @code{hello-c++}, @code{hello-c++-qt},
65@code{hello-c++-kde}, @code{hello-c++-gnome}, @code{hello-c++-wxwidgets},
66@code{hello-objc}, @code{hello-objc-gnustep}, @code{hello-objc-gnome}.
67