man-pages/man3/ngettext.3.html
2021-03-31 01:06:50 +01:00

97 lines
3.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of NGETTEXT</TITLE>
</HEAD><BODY>
<H1>NGETTEXT</H1>
Section: C Library Functions (3)<BR>Updated: May 2001<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ngettext, dngettext, dcngettext - translate message and choose plural form
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/libintl.h">libintl.h</A>&gt;</B>
<B>char * ngettext (const char * </B><I>msgid</I><B>, const char * </B><I>msgid_plural</I><B>,</B>
<B> unsigned long int </B><I>n</I><B>);</B>
<B>char * dngettext (const char * </B><I>domainname</I><B>,</B>
<B> const char * </B><I>msgid</I><B>, const char * </B><I>msgid_plural</I><B>,</B>
<B> unsigned long int </B><I>n</I><B>);</B>
<B>char * dcngettext (const char * </B><I>domainname</I><B>,</B>
<B> const char * </B><I>msgid</I><B>, const char * </B><I>msgid_plural</I><B>,</B>
<B> unsigned long int </B><I>n</I><B>, int </B><I>category</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>ngettext</B>, <B>dngettext</B> and <B>dcngettext</B> functions attempt to
translate a text string into the user's native language, by looking up the
appropriate plural form of the translation in a message catalog.
<P>
Plural forms are grammatical variants depending on the a number. Some languages
have two forms, called singular and plural. Other languages have three forms,
called singular, dual and plural. There are also languages with four forms.
<P>
The <B>ngettext</B>, <B>dngettext</B> and <B>dcngettext</B> functions work like
the <B>gettext</B>, <B>dgettext</B> and <B>dcgettext</B> functions, respectively.
Additionally, they choose the appropriate plural form, which depends on the
number <I>n</I> and the language of the message catalog where the translation
was found.
<P>
In the &quot;C&quot; locale, or if none of the used catalogs contain a translation for
<I>msgid</I>, the <B>ngettext</B>, <B>dngettext</B> and <B>dcngettext</B> functions
return <I>msgid</I> if <I>n</I> == 1, or <I>msgid_plural</I> if <I>n</I> != 1.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
If a translation was found in one of the specified catalogs, the appropriate
plural form is converted to the locale's codeset and returned. The resulting
string is statically allocated and must not be modified or freed. Otherwise
<I>msgid</I> or <I>msgid_plural</I> is returned, as described above.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<B>errno</B> is not modified.
<A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2>
The return type ought to be <B>const char *</B>, but is <B>char *</B> to avoid
warnings in C code predating ANSI C.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+gettext">gettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dgettext">dgettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dcgettext">dcgettext</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="5"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="6"><A HREF="#lbAG">BUGS</A><DD>
<DT id="7"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:49 GMT, March 31, 2021
</BODY>
</HTML>