1 <!-- Creator : groff version 1.22.2 -->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
3 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta name="generator" content="groff -Thtml, see www.gnu.org">
7 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
8 <meta name="Content-Style" content="text/css">
9 <style type="text/css">
10 p { margin-top: 0; margin-bottom: 0; vertical-align: top }
11 pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
12 table { margin-top: 0; margin-bottom: 0; vertical-align: top }
13 h1 { text-align: center }
15 <title>NGETTEXT</title>
20 <h1 align="center">NGETTEXT</h1>
22 <a href="#NAME">NAME</a><br>
23 <a href="#SYNOPSIS">SYNOPSIS</a><br>
24 <a href="#DESCRIPTION">DESCRIPTION</a><br>
25 <a href="#RETURN VALUE">RETURN VALUE</a><br>
26 <a href="#ERRORS">ERRORS</a><br>
27 <a href="#BUGS">BUGS</a><br>
28 <a href="#SEE ALSO">SEE ALSO</a><br>
38 <p style="margin-left:11%; margin-top: 1em">ngettext,
39 dngettext, dcngettext − translate message and choose
43 <a name="SYNOPSIS"></a>
47 <p style="margin-left:11%; margin-top: 1em"><b>#include
48 <libintl.h></b></p>
50 <p style="margin-left:11%; margin-top: 1em"><b>char *
51 ngettext (const char *</b> <i>msgid</i><b>, const char *</b>
52 <i>msgid_plural</i><b>, <br>
53 unsigned long int</b> <i>n</i><b>); <br>
54 char * dngettext (const char *</b> <i>domainname</i><b>,
56 const char *</b> <i>msgid</i><b>, const char *</b>
57 <i>msgid_plural</i><b>, <br>
58 unsigned long int</b> <i>n</i><b>); <br>
59 char * dcngettext (const char *</b> <i>domainname</i><b>,
61 const char *</b> <i>msgid</i><b>, const char *</b>
62 <i>msgid_plural</i><b>, <br>
63 unsigned long int</b> <i>n</i><b>, int</b>
64 <i>category</i><b>);</b></p>
67 <a name="DESCRIPTION"></a>
71 <p style="margin-left:11%; margin-top: 1em">The
72 <b>ngettext</b>, <b>dngettext</b> and <b>dcngettext</b>
73 functions attempt to translate a text string into the
74 user’s native language, by looking up the appropriate
75 plural form of the translation in a message catalog.</p>
77 <p style="margin-left:11%; margin-top: 1em">Plural forms
78 are grammatical variants depending on the a number. Some
79 languages have two forms, called singular and plural. Other
80 languages have three forms, called singular, dual and
81 plural. There are also languages with four forms.</p>
83 <p style="margin-left:11%; margin-top: 1em">The
84 <b>ngettext</b>, <b>dngettext</b> and <b>dcngettext</b>
85 functions work like the <b>gettext</b>, <b>dgettext</b> and
86 <b>dcgettext</b> functions, respectively. Additionally, they
87 choose the appropriate plural form, which depends on the
88 number <i>n</i> and the language of the message catalog
89 where the translation was found.</p>
91 <p style="margin-left:11%; margin-top: 1em">In the
92 "C" locale, or if none of the used catalogs
93 contain a translation for <i>msgid</i>, the <b>ngettext</b>,
94 <b>dngettext</b> and <b>dcngettext</b> functions return
95 <i>msgid</i> if <i>n</i> == 1, or <i>msgid_plural</i> if
99 <a name="RETURN VALUE"></a>
103 <p style="margin-left:11%; margin-top: 1em">If a
104 translation was found in one of the specified catalogs, the
105 appropriate plural form is converted to the locale’s
106 codeset and returned. The resulting string is statically
107 allocated and must not be modified or freed. Otherwise
108 <i>msgid</i> or <i>msgid_plural</i> is returned, as
112 <a name="ERRORS"></a>
116 <p style="margin-left:11%; margin-top: 1em"><b>errno</b> is
124 <p style="margin-left:11%; margin-top: 1em">The return type
125 ought to be <b>const char *</b>, but is <b>char *</b> to
126 avoid warnings in C code predating ANSI C.</p>
129 <a name="SEE ALSO"></a>
134 <p style="margin-left:11%; margin-top: 1em"><b>gettext</b>(3),
135 <b>dgettext</b>(3), <b>dcgettext</b>(3)</p>