jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:ngettext, jpayne@68: dngettext, dcngettext - translate message and choose jpayne@68: plural form
jpayne@68: jpayne@68:#include jpayne@68: <libintl.h>
jpayne@68: jpayne@68:char *
jpayne@68: ngettext (const char * msgid, const char *
jpayne@68: msgid_plural,
jpayne@68: unsigned long int n);
jpayne@68: char * dngettext (const char * domainname,
jpayne@68:
jpayne@68: const char * msgid, const char *
jpayne@68: msgid_plural,
jpayne@68: unsigned long int n);
jpayne@68: char * dcngettext (const char * domainname,
jpayne@68:
jpayne@68: const char * msgid, const char *
jpayne@68: msgid_plural,
jpayne@68: unsigned long int n, int
jpayne@68: category);
The jpayne@68: ngettext, dngettext and dcngettext jpayne@68: functions attempt to translate a text string into the jpayne@68: user’s native language, by looking up the appropriate jpayne@68: plural form of the translation in a message catalog.
jpayne@68: jpayne@68:Plural forms jpayne@68: are grammatical variants depending on the a number. Some jpayne@68: languages have two forms, called singular and plural. Other jpayne@68: languages have three forms, called singular, dual and jpayne@68: plural. There are also languages with four forms.
jpayne@68: jpayne@68:The jpayne@68: ngettext, dngettext and dcngettext jpayne@68: functions work like the gettext, dgettext and jpayne@68: dcgettext functions, respectively. Additionally, they jpayne@68: choose the appropriate plural form, which depends on the jpayne@68: number n and the language of the message catalog jpayne@68: where the translation was found.
jpayne@68: jpayne@68:In the jpayne@68: "C" locale, or if none of the used catalogs jpayne@68: contain a translation for msgid, the ngettext, jpayne@68: dngettext and dcngettext functions return jpayne@68: msgid if n == 1, or msgid_plural if jpayne@68: n != 1.
jpayne@68: jpayne@68:If a jpayne@68: translation was found in one of the specified catalogs, the jpayne@68: appropriate plural form is converted to the locale’s jpayne@68: codeset and returned. The resulting string is statically jpayne@68: allocated and must not be modified or freed. Otherwise jpayne@68: msgid or msgid_plural is returned, as jpayne@68: described above.
jpayne@68: jpayne@68:errno is jpayne@68: not modified.
jpayne@68: jpayne@68:The return type jpayne@68: ought to be const char *, but is char * to jpayne@68: avoid warnings in C code predating ANSI C.
jpayne@68: jpayne@68:gettext(3), jpayne@68: dgettext(3), dcgettext(3)
jpayne@68: