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

116 lines
3.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of BINDTEXTDOMAIN</TITLE>
</HEAD><BODY>
<H1>BINDTEXTDOMAIN</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>
bindtextdomain - set directory containing message catalogs
<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 * bindtextdomain (const char * </B><I>domainname</I><B>, const char * </B><I>dirname</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>bindtextdomain</B> function sets the base directory of the hierarchy
containing message catalogs for a given message domain.
<P>
A message domain is a set of translatable <I>msgid</I> messages. Usually,
every software package has its own message domain. The need for calling
<B>bindtextdomain</B> arises because packages are not always installed with
the same prefix as the &lt;<A HREF="file:///usr/include/libintl.h">libintl.h</A>&gt; header and the libc/libintl libraries.
<P>
Message catalogs will be expected at the pathnames
<I>dirname</I>/<I>locale</I>/<I>category</I>/<I>domainname</I>.mo,
where <I>locale</I> is a locale name and <I>category</I> is a locale facet such
as <B>LC_MESSAGES</B>.
<P>
<I>domainname</I> must be a non-empty string.
<P>
If <I>dirname</I> is not NULL, the base directory for message catalogs belonging
to domain <I>domainname</I> is set to <I>dirname</I>. The function makes copies
of the argument strings as needed. If the program wishes to call the
<B>chdir</B> function, it is important that <I>dirname</I> be an absolute
pathname; otherwise it cannot be guaranteed that the message catalogs will
be found.
<P>
If <I>dirname</I> is NULL, the function returns the previously set base
directory for domain <I>domainname</I>.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
If successful, the <B>bindtextdomain</B> function returns the current base
directory for domain <I>domainname</I>, after possibly changing it. The
resulting string is valid until the next <B>bindtextdomain</B> call for the
same <I>domainname</I> and must not be modified or freed. If a memory allocation
failure occurs, it sets <B>errno</B> to <B>ENOMEM</B> and returns NULL.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
The following error can occur, among others:
<DL COMPACT>
<DT id="1"><B>ENOMEM</B>
<DD>
Not enough memory available.
</DL>
<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),
<B><A HREF="/cgi-bin/man/man2html?3+ngettext">ngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dngettext">dngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+dcngettext">dcngettext</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+textdomain">textdomain</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+realpath">realpath</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="2"><A HREF="#lbAB">NAME</A><DD>
<DT id="3"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="4"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="5"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="6"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="7"><A HREF="#lbAG">BUGS</A><DD>
<DT id="8"><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:36 GMT, March 31, 2021
</BODY>
</HTML>