1 /* Message catalogs for internationalization. 2 Copyright (C) 1995-1997, 2000-2002 Free Software Foundation, Inc. 3 4 This program is free software; you can redistribute it and/or modify it 5 under the terms of the GNU Library General Public License as published 6 by the Free Software Foundation; either version 2, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public 15 License along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 17 USA. */ 18 19 #ifndef _LIBINTL_H 20 #define _LIBINTL_H 1 21 22 #include <locale.h> 23 24 /* The LC_MESSAGES locale category is the category used by the functions 25 gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. 26 On systems that don't define it, use an arbitrary value instead. 27 On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5) 28 then includes <libintl.h> (i.e. this file!) and then only defines 29 LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES 30 in this case. */ 31 #if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun)) 32 # define LC_MESSAGES 1729 33 #endif 34 35 /* We define an additional symbol to signal that we use the GNU 36 implementation of gettext. */ 37 #define __USE_GNU_GETTEXT 1 38 39 /* Resolve a platform specific conflict on DJGPP. GNU gettext takes 40 precedence over _conio_gettext. */ 41 #ifdef __DJGPP__ 42 # undef gettext 43 # define gettext gettext 44 #endif 45 46 /* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers 47 used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */ 48 #ifndef _INTL_PARAMS 49 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 50 # define _INTL_PARAMS(args) args 51 # else 52 # define _INTL_PARAMS(args) () 53 # endif 54 #endif 55 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 59 60 /* Look up MSGID in the current default message catalog for the current 61 LC_MESSAGES locale. If not found, returns MSGID itself (the default 62 text). */ 63 extern char *gettext _INTL_PARAMS ((const char *__msgid)); 64 65 /* Look up MSGID in the DOMAINNAME message catalog for the current 66 LC_MESSAGES locale. */ 67 extern char *dgettext _INTL_PARAMS ((const char *__domainname, 68 const char *__msgid)); 69 70 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY 71 locale. */ 72 extern char *dcgettext _INTL_PARAMS ((const char *__domainname, 73 const char *__msgid, 74 int __category)); 75 76 77 /* Similar to `gettext' but select the plural form corresponding to the 78 number N. */ 79 extern char *ngettext _INTL_PARAMS ((const char *__msgid1, 80 const char *__msgid2, 81 unsigned long int __n)); 82 83 /* Similar to `dgettext' but select the plural form corresponding to the 84 number N. */ 85 extern char *dngettext _INTL_PARAMS ((const char *__domainname, 86 const char *__msgid1, 87 const char *__msgid2, 88 unsigned long int __n)); 89 90 /* Similar to `dcgettext' but select the plural form corresponding to the 91 number N. */ 92 extern char *dcngettext _INTL_PARAMS ((const char *__domainname, 93 const char *__msgid1, 94 const char *__msgid2, 95 unsigned long int __n, 96 int __category)); 97 98 99 /* Set the current default message catalog to DOMAINNAME. 100 If DOMAINNAME is null, return the current default. 101 If DOMAINNAME is "", reset to the default of "messages". */ 102 extern char *textdomain _INTL_PARAMS ((const char *__domainname)); 103 104 /* Specify that the DOMAINNAME message catalog will be found 105 in DIRNAME rather than in the system locale data base. */ 106 extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname, 107 const char *__dirname)); 108 109 /* Specify the character encoding in which the messages from the 110 DOMAINNAME message catalog will be returned. */ 111 extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, 112 const char *__codeset)); 113 114 115 /* Optimized version of the functions above. */ 116 #if defined __OPTIMIZED 117 /* These are macros, but could also be inline functions. */ 118 119 # define gettext(msgid) \ 120 dgettext (NULL, msgid) 121 122 # define dgettext(domainname, msgid) \ 123 dcgettext (domainname, msgid, LC_MESSAGES) 124 125 # define ngettext(msgid1, msgid2, n) \ 126 dngettext (NULL, msgid1, msgid2, n) 127 128 # define dngettext(domainname, msgid1, msgid2, n) \ 129 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) 130 131 #endif /* Optimizing. */ 132 133 134 #ifdef __cplusplus 135 } 136 #endif 137 138 #endif /* libintl.h */ 139