gettext: Ambiguities

1 
1 11.2.2 Solving Ambiguities
1 --------------------------
1 
1    While this single name domain works well for most applications there
1 might be the need to get translations from more than one domain.  Of
1 course one could switch between different domains with calls to
1 ‘textdomain’, but this is really not convenient nor is it fast.  A
1 possible situation could be one case subject to discussion during this
1 writing: all error messages of functions in the set of common used
1 functions should go into a separate domain ‘error’.  By this mean we
1 would only need to translate them once.  Another case are messages from
1 a library, as these _have_ to be independent of the current domain set
1 by the application.
1 
1 For this reasons there are two more functions to retrieve strings:
1 
1      char *dgettext (const char *domain_name, const char *msgid);
1      char *dcgettext (const char *domain_name, const char *msgid,
1                       int category);
1 
1    Both take an additional argument at the first place, which
1 corresponds to the argument of ‘textdomain’.  The third argument of
1 ‘dcgettext’ allows to use another locale category but ‘LC_MESSAGES’.
1 But I really don’t know where this can be useful.  If the DOMAIN_NAME is
1 ‘NULL’ or CATEGORY has an value beside the known ones, the result is
1 undefined.  It should also be noted that this function is not part of
1 the second known implementation of this function family, the one found
1 in Solaris.
1 
1    A second ambiguity can arise by the fact, that perhaps more than one
1 domain has the same name.  This can be solved by specifying where the
1 needed message catalog files can be found.
1 
1      char *bindtextdomain (const char *domain_name,
1                            const char *dir_name);
1 
1    Calling this function binds the given domain to a file in the
1 specified directory (how this file is determined follows below).
1 Especially a file in the systems default place is not favored against
1 the specified file anymore (as it would be by solely using
1 ‘textdomain’).  A ‘NULL’ pointer for the DIR_NAME parameter returns the
1 binding associated with DOMAIN_NAME.  If DOMAIN_NAME itself is ‘NULL’
1 nothing happens and a ‘NULL’ pointer is returned.  Here again as for all
1 the other functions is true that none of the return value must be
1 changed!
1 
1    It is important to remember that relative path names for the DIR_NAME
1 parameter can be trouble.  Since the path is always computed relative to
1 the current directory different results will be achieved when the
1 program executes a ‘chdir’ command.  Relative paths should always be
1 avoided to avoid dependencies and unreliabilities.
1