Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-runtime / man / ngettext.3.html
1 <!-- Creator     : groff version 1.22.3 -->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
3 "http://www.w3.org/TR/html4/loose.dtd">
4 <html>
5 <head>
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 }
14 </style>
15 <title>NGETTEXT</title>
16
17 </head>
18 <body>
19
20 <h1 align="center">NGETTEXT</h1>
21
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>
29
30 <hr>
31
32
33 <h2>NAME
34 <a name="NAME"></a>
35 </h2>
36
37
38 <p style="margin-left:11%; margin-top: 1em">ngettext,
39 dngettext, dcngettext &minus; translate message and choose
40 plural form</p>
41
42 <h2>SYNOPSIS
43 <a name="SYNOPSIS"></a>
44 </h2>
45
46
47 <p style="margin-left:11%; margin-top: 1em"><b>#include
48 &lt;libintl.h&gt;</b></p>
49
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>,
55 <br>
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>,
60 <br>
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>
65
66 <h2>DESCRIPTION
67 <a name="DESCRIPTION"></a>
68 </h2>
69
70
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&rsquo;s native language, by looking up the appropriate
75 plural form of the translation in a message catalog.</p>
76
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>
82
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>
90
91 <p style="margin-left:11%; margin-top: 1em">In the
92 &quot;C&quot; 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
96 <i>n</i> != 1.</p>
97
98 <h2>RETURN VALUE
99 <a name="RETURN VALUE"></a>
100 </h2>
101
102
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&rsquo;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
109 described above.</p>
110
111 <h2>ERRORS
112 <a name="ERRORS"></a>
113 </h2>
114
115
116 <p style="margin-left:11%; margin-top: 1em"><b>errno</b> is
117 not modified.</p>
118
119 <h2>BUGS
120 <a name="BUGS"></a>
121 </h2>
122
123
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>
127
128 <h2>SEE ALSO
129 <a name="SEE ALSO"></a>
130 </h2>
131
132
133
134 <p style="margin-left:11%; margin-top: 1em"><b>gettext</b>(3),
135 <b>dgettext</b>(3), <b>dcgettext</b>(3)</p>
136 <hr>
137 </body>
138 </html>