manpagez: man pages & more
info gettext
Home | html | info | man

File: gettext.info,  Node: C,  Next: Python,  Up: List of Programming Languages

16.5.1 C, C++, Objective C
--------------------------

RPMs
     gcc, gpp, gobjc, glibc, gettext

Ubuntu packages
     gcc, g++, gobjc, libc6-dev, libasprintf-dev

File extension
     For C: ‘c’, ‘h’.
     For C++: ‘C’, ‘c++’, ‘cc’, ‘cxx’, ‘cpp’, ‘hpp’.
     For Objective C: ‘m’.

String syntax
     ‘"abc"’

gettext shorthand
     ‘_("abc")’

gettext/ngettext functions
     ‘gettext’, ‘dgettext’, ‘dcgettext’, ‘ngettext’, ‘dngettext’,
     ‘dcngettext’

textdomain
     ‘textdomain’ function

bindtextdomain
     ‘bindtextdomain’ and ‘wbindtextdomain’ functions

setlocale
     Programmer must call ‘setlocale (LC_ALL, "")’

Prerequisite
     ‘#include ’
     ‘#include ’
     ‘#define _(string) gettext (string)’

Use or emulate GNU gettext
     Use

Extractor
     ‘xgettext -k_’
     For C++ with the Boost library: ‘xgettext --boost -k_’

Formatting with positions
     ‘fprintf "%2$d %1$d"’
     In C++: ‘autosprintf "%2$d %1$d"’ (*note Introduction:
     (autosprintf)Top.)
     In C++ 20 or newer: ‘std::vformat "{1} {0}"’
     In C++ with the Boost library: ‘boost::format "%2% %1%"’

Portability
     autoconf (gettext.m4) and #if ENABLE_NLS

po-mode marking
     yes

   The following examples are available in the ‘examples’ directory:
‘hello-c’, ‘hello-c-gnome2’, ‘hello-c-gnome3’, ‘hello-c-http’,
‘hello-c++’, ‘hello-c++20’, ‘hello-c++-qt’, ‘hello-c++-kde’,
‘hello-c++-gnome2’, ‘hello-c++-gnome3’, ‘hello-c++-wxwidgets’,
‘hello-objc’, ‘hello-objc-gnustep’, ‘hello-objc-gnome2’.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.