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., 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 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 #ifndef PARAMS 46 # if __STDC__ || defined __cplusplus 47 # define PARAMS(args) args 48 # else 49 # define PARAMS(args) () 50 # endif 51 #endif 52 53 #ifdef __cplusplus 54 extern "C" { 55 #endif 56 57 /* Look up MSGID in the current default message catalog for the current 58 LC_MESSAGES locale. If not found, returns MSGID itself (the default 59 text). */ 60 extern char *gettext PARAMS ((const char *__msgid)); 61 62 /* Look up MSGID in the DOMAINNAME message catalog for the current 63 LC_MESSAGES locale. */ 64 extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid)); 65 66 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY 67 locale. */ 68 extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, 69 int __category)); 70 71 72 /* Similar to `gettext' but select the plural form corresponding to the 73 number N. */ 74 extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2, 75 unsigned long int __n)); 76 77 /* Similar to `dgettext' but select the plural form corresponding to the 78 number N. */ 79 extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1, 80 const char *__msgid2, unsigned long int __n)); 81 82 /* Similar to `dcgettext' but select the plural form corresponding to the 83 number N. */ 84 extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1, 85 const char *__msgid2, unsigned long int __n, 86 int __category)); 87 88 89 /* Set the current default message catalog to DOMAINNAME. 90 If DOMAINNAME is null, return the current default. 91 If DOMAINNAME is "", reset to the default of "messages". */ 92 extern char *textdomain PARAMS ((const char *__domainname)); 93 94 /* Specify that the DOMAINNAME message catalog will be found 95 in DIRNAME rather than in the system locale data base. */ 96 extern char *bindtextdomain PARAMS ((const char *__domainname, 97 const char *__dirname)); 98 99 /* Specify the character encoding in which the messages from the 100 DOMAINNAME message catalog will be returned. */ 101 extern char *bind_textdomain_codeset PARAMS ((const char *__domainname, 102 const char *__codeset)); 103 104 105 /* Optimized version of the functions above. */ 106 #if defined __OPTIMIZED 107 /* These are macros, but could also be inline functions. */ 108 109 # define gettext(msgid) \ 110 dgettext (NULL, msgid) 111 112 # define dgettext(domainname, msgid) \ 113 dcgettext (domainname, msgid, LC_MESSAGES) 114 115 # define ngettext(msgid1, msgid2, n) \ 116 dngettext (NULL, msgid1, msgid2, n) 117 118 # define dngettext(domainname, msgid1, msgid2, n) \ 119 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) 120 121 #endif /* Optimizing. */ 122 123 124 #ifdef __cplusplus 125 } 126 #endif 127 128 #endif /* libintl.h */ 129