1 /* Message catalogs for internationalization. 2 Copyright (C) 1995-1997, 2000, 2001 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 then includes <libintl.h> (i.e. 28 this file!) and then only defines LC_MESSAGES. To avoid a redefinition 29 warning, don't define LC_MESSAGES in this case. */ 30 #if !defined LC_MESSAGES && !defined __LOCALE_H 31 # define LC_MESSAGES 1729 32 #endif 33 34 /* We define an additional symbol to signal that we use the GNU 35 implementation of gettext. */ 36 #define __USE_GNU_GETTEXT 1 37 38 /* Resolve a platform specific conflict on DJGPP. GNU gettext takes 39 precedence over _conio_gettext. */ 40 #ifdef __DJGPP__ 41 # undef gettext 42 # define gettext gettext 43 #endif 44 45 /* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers 46 used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */ 47 #ifndef _INTL_PARAMS 48 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 49 # define _INTL_PARAMS(args) args 50 # else 51 # define _INTL_PARAMS(args) () 52 # endif 53 #endif 54 55 #ifdef __cplusplus 56 extern "C" { 57 #endif 58 59 /* Look up MSGID in the current default message catalog for the current 60 LC_MESSAGES locale. If not found, returns MSGID itself (the default 61 text). */ 62 extern char *gettext _INTL_PARAMS ((const char *__msgid)); 63 64 /* Look up MSGID in the DOMAINNAME message catalog for the current 65 LC_MESSAGES locale. */ 66 extern char *dgettext _INTL_PARAMS ((const char *__domainname, 67 const char *__msgid)); 68 69 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY 70 locale. */ 71 extern char *dcgettext _INTL_PARAMS ((const char *__domainname, 72 const char *__msgid, 73 int __category)); 74 75 76 /* Similar to `gettext' but select the plural form corresponding to the 77 number N. */ 78 extern char *ngettext _INTL_PARAMS ((const char *__msgid1, 79 const char *__msgid2, 80 unsigned long int __n)); 81 82 /* Similar to `dgettext' but select the plural form corresponding to the 83 number N. */ 84 extern char *dngettext _INTL_PARAMS ((const char *__domainname, 85 const char *__msgid1, 86 const char *__msgid2, 87 unsigned long int __n)); 88 89 /* Similar to `dcgettext' but select the plural form corresponding to the 90 number N. */ 91 extern char *dcngettext _INTL_PARAMS ((const char *__domainname, 92 const char *__msgid1, 93 const char *__msgid2, 94 unsigned long int __n, 95 int __category)); 96 97 98 /* Set the current default message catalog to DOMAINNAME. 99 If DOMAINNAME is null, return the current default. 100 If DOMAINNAME is "", reset to the default of "messages". */ 101 extern char *textdomain _INTL_PARAMS ((const char *__domainname)); 102 103 /* Specify that the DOMAINNAME message catalog will be found 104 in DIRNAME rather than in the system locale data base. */ 105 extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname, 106 const char *__dirname)); 107 108 /* Specify the character encoding in which the messages from the 109 DOMAINNAME message catalog will be returned. */ 110 extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, 111 const char *__codeset)); 112 113 114 /* Optimized version of the functions above. */ 115 #if defined __OPTIMIZED 116 /* These are macros, but could also be inline functions. */ 117 118 # define gettext(msgid) \ 119 dgettext (NULL, msgid) 120 121 # define dgettext(domainname, msgid) \ 122 dcgettext (domainname, msgid, LC_MESSAGES) 123 124 # define ngettext(msgid1, msgid2, n) \ 125 dngettext (NULL, msgid1, msgid2, n) 126 127 # define dngettext(domainname, msgid1, msgid2, n) \ 128 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) 129 130 #endif /* Optimizing. */ 131 132 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif /* libintl.h */ 138