jpayne@68: jpayne@68: jpayne@68: jpayne@68:
jpayne@68: jpayne@68: jpayne@68: jpayne@68: jpayne@68:bindtextdomain jpayne@68: - set directory containing message catalogs
jpayne@68: jpayne@68:#include jpayne@68: <libintl.h>
jpayne@68: jpayne@68:char * jpayne@68: bindtextdomain (const char * domainname, const jpayne@68: char * dirname);
jpayne@68: jpayne@68:The jpayne@68: bindtextdomain function sets the base directory of jpayne@68: the hierarchy containing message catalogs for a given jpayne@68: message domain.
jpayne@68: jpayne@68:A message jpayne@68: domain is a set of translatable msgid messages. jpayne@68: Usually, every software package has its own message domain. jpayne@68: The need for calling bindtextdomain arises because jpayne@68: packages are not always installed with the same prefix as jpayne@68: the <libintl.h> header and the libc/libintl jpayne@68: libraries.
jpayne@68: jpayne@68:Message jpayne@68: catalogs will be expected at the pathnames jpayne@68: dirname/locale/category/domainname.mo, jpayne@68: where locale is a locale name and category is jpayne@68: a locale facet such as LC_MESSAGES.
jpayne@68: jpayne@68: jpayne@68:domainname jpayne@68: must be a non-empty string.
jpayne@68: jpayne@68:If jpayne@68: dirname is not NULL, the base directory for message jpayne@68: catalogs belonging to domain domainname is set to jpayne@68: dirname. The function makes copies of the argument jpayne@68: strings as needed. If the program wishes to call the jpayne@68: chdir function, it is important that dirname jpayne@68: be an absolute pathname; otherwise it cannot be guaranteed jpayne@68: that the message catalogs will be found.
jpayne@68: jpayne@68:If jpayne@68: dirname is NULL, the function returns the previously jpayne@68: set base directory for domain domainname.
jpayne@68: jpayne@68:If successful, jpayne@68: the bindtextdomain function returns the current base jpayne@68: directory for domain domainname, after possibly jpayne@68: changing it. The resulting string is valid until the next jpayne@68: bindtextdomain call for the same domainname jpayne@68: and must not be modified or freed. If a memory allocation jpayne@68: failure occurs, it sets errno to ENOMEM and jpayne@68: returns NULL.
jpayne@68: jpayne@68:The following jpayne@68: error can occur, among others:
jpayne@68: jpayne@68:jpayne@68: |
jpayne@68:
jpayne@68:
jpayne@68: ENOMEM |
jpayne@68: jpayne@68: |
jpayne@68:
jpayne@68:
jpayne@68: Not enough memory available. |
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), ngettext(3), jpayne@68: dngettext(3), dcngettext(3), jpayne@68: textdomain(3), realpath(3)
jpayne@68: