ngettext

Name

ngettext -- search message catalogs for plural string

Synopsis

#include <libintl.h>

char * ngettext(const char * msgid1, const char * msgid2, unsigned long int n);

Description

The ngettext() function shall search the currently selected message catalogs for a string matching the singular string msgid1. If a string is located, and if n is 1, that string shall be returned. If n is not 1, a pluralized version (dependent on n) of the string shall be returned.

The ngettext() function is equivalent to dcngettext(NULL, msgid1, msgid2, n, LC_MESSAGES)().

Return Value

If a string is found in the currently selected message catalogs for msgid1, then if n is 1 a pointer to the located string shall be returned. If n is not 1, a pointer to an appropriately pluralized version of the string shall be returned. If no message could be found in the currently selected mesage catalogs, then if n is 1, a pointer to msgid1 shall be returned, otherwise a pointer to msgid2 shall be returned.

Applications shall not modify the string returned by ngettext().

Errors

None.

The ngettext() function shall not modify errno.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset