blob: dc00fa0f57978df0ac7eb9d3db1fb3e1930f14af [file] [log] [blame]
@c This file is part of the GNU gettext manual.
@c Copyright (C) 1995-2020 Free Software Foundation, Inc.
@c See the file gettext.texi for copying conditions.
@node C
@subsection C, C++, Objective C
@cindex C and C-like languages
@table @asis
@item RPMs
gcc, gpp, gobjc, glibc, gettext
@item Ubuntu packages
gcc, g++, gobjc, libc6-dev, libasprintf-dev
@item File extension
For C: @code{c}, @code{h}.
@*For C++: @code{C}, @code{c++}, @code{cc}, @code{cxx}, @code{cpp}, @code{hpp}.
@*For Objective C: @code{m}.
@item String syntax
@code{"abc"}
@item gettext shorthand
@code{_("abc")}
@item gettext/ngettext functions
@code{gettext}, @code{dgettext}, @code{dcgettext}, @code{ngettext},
@code{dngettext}, @code{dcngettext}
@item textdomain
@code{textdomain} function
@item bindtextdomain
@code{bindtextdomain} and @code{wbindtextdomain} functions
@item setlocale
Programmer must call @code{setlocale (LC_ALL, "")}
@item Prerequisite
@code{#include <libintl.h>}
@*@code{#include <locale.h>}
@*@code{#define _(string) gettext (string)}
@item Use or emulate GNU gettext
Use
@item Extractor
@code{xgettext -k_}
@item Formatting with positions
@code{fprintf "%2$d %1$d"}
@*In C++: @code{autosprintf "%2$d %1$d"}
(@pxref{Top, , Introduction, autosprintf, GNU autosprintf})
@item Portability
autoconf (gettext.m4) and #if ENABLE_NLS
@item po-mode marking
yes
@end table
The following examples are available in the @file{examples} directory:
@code{hello-c}, @code{hello-c-gnome}, @code{hello-c++}, @code{hello-c++-qt},
@code{hello-c++-kde}, @code{hello-c++-gnome}, @code{hello-c++-wxwidgets},
@code{hello-objc}, @code{hello-objc-gnustep}, @code{hello-objc-gnome}.