1NGETTEXT(3) Library Functions Manual NGETTEXT(3)
2
3
4
6 ngettext, dngettext, dcngettext - translate message and choose plural
7 form
8
10 #include <libintl.h>
11
12 char * ngettext (const char * msgid, const char * msgid_plural,
13 unsigned long int n);
14 char * dngettext (const char * domainname,
15 const char * msgid, const char * msgid_plural,
16 unsigned long int n);
17 char * dcngettext (const char * domainname,
18 const char * msgid, const char * msgid_plural,
19 unsigned long int n, int category);
20
22 The ngettext, dngettext and dcngettext functions attempt to translate a
23 text string into the user's native language, by looking up the appro‐
24 priate plural form of the translation in a message catalog.
25
26 Plural forms are grammatical variants depending on the a number. Some
27 languages have two forms, called singular and plural. Other languages
28 have three forms, called singular, dual and plural. There are also lan‐
29 guages with four forms.
30
31 The ngettext, dngettext and dcngettext functions work like the gettext,
32 dgettext and dcgettext functions, respectively. Additionally, they
33 choose the appropriate plural form, which depends on the number n and
34 the language of the message catalog where the translation was found.
35
36 In the "C" locale, or if none of the used catalogs contain a transla‐
37 tion for msgid, the ngettext, dngettext and dcngettext functions return
38 msgid if n == 1, or msgid_plural if n != 1.
39
41 If a translation was found in one of the specified catalogs, the appro‐
42 priate plural form is converted to the locale's codeset and returned.
43 The resulting string is statically allocated and must not be modified
44 or freed. Otherwise msgid or msgid_plural is returned, as described
45 above.
46
48 errno is not modified.
49
51 The return type ought to be const char *, but is char * to avoid warn‐
52 ings in C code predating ANSI C.
53
55 gettext(3), dgettext(3), dcgettext(3)
56
57
58
59GNU gettext 0.16.1 May 2001 NGETTEXT(3)