00001 /* Message catalogs for internationalization. 00002 Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. 00003 00004 This program is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published 00006 by the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00017 USA. */ 00018 00019 #ifndef _LIBINTL_H 00020 #define _LIBINTL_H 1 00021 00022 #include <locale.h> 00023 00024 /* The LC_MESSAGES locale category is the category used by the functions 00025 gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. 00026 On systems that don't define it, use an arbitrary value instead. 00027 On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e. 00028 this file!) and then only defines LC_MESSAGES. To avoid a redefinition 00029 warning, don't define LC_MESSAGES in this case. */ 00030 #if !defined LC_MESSAGES && !defined __LOCALE_H 00031 # define LC_MESSAGES 1729 00032 #endif 00033 00034 /* We define an additional symbol to signal that we use the GNU 00035 implementation of gettext. */ 00036 #define __USE_GNU_GETTEXT 1 00037 00038 /* Resolve a platform specific conflict on DJGPP. GNU gettext takes 00039 precedence over _conio_gettext. */ 00040 #ifdef __DJGPP__ 00041 # undef gettext 00042 # define gettext gettext 00043 #endif 00044 00045 /* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers 00046 used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */ 00047 #ifndef _INTL_PARAMS 00048 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 00049 # define _INTL_PARAMS(args) args 00050 # else 00051 # define _INTL_PARAMS(args) () 00052 # endif 00053 #endif 00054 00055 #ifdef __cplusplus 00056 extern "C" { 00057 #endif 00058 00059 /* Look up MSGID in the current default message catalog for the current 00060 LC_MESSAGES locale. If not found, returns MSGID itself (the default 00061 text). */ 00062 extern char *gettext _INTL_PARAMS ((const char *__msgid)); 00063 00064 /* Look up MSGID in the DOMAINNAME message catalog for the current 00065 LC_MESSAGES locale. */ 00066 extern char *dgettext _INTL_PARAMS ((const char *__domainname, 00067 const char *__msgid)); 00068 00069 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY 00070 locale. */ 00071 extern char *dcgettext _INTL_PARAMS ((const char *__domainname, 00072 const char *__msgid, 00073 int __category)); 00074 00075 00076 /* Similar to `gettext' but select the plural form corresponding to the 00077 number N. */ 00078 extern char *ngettext _INTL_PARAMS ((const char *__msgid1, 00079 const char *__msgid2, 00080 unsigned long int __n)); 00081 00082 /* Similar to `dgettext' but select the plural form corresponding to the 00083 number N. */ 00084 extern char *dngettext _INTL_PARAMS ((const char *__domainname, 00085 const char *__msgid1, 00086 const char *__msgid2, 00087 unsigned long int __n)); 00088 00089 /* Similar to `dcgettext' but select the plural form corresponding to the 00090 number N. */ 00091 extern char *dcngettext _INTL_PARAMS ((const char *__domainname, 00092 const char *__msgid1, 00093 const char *__msgid2, 00094 unsigned long int __n, 00095 int __category)); 00096 00097 00098 /* Set the current default message catalog to DOMAINNAME. 00099 If DOMAINNAME is null, return the current default. 00100 If DOMAINNAME is "", reset to the default of "messages". */ 00101 extern char *textdomain _INTL_PARAMS ((const char *__domainname)); 00102 00103 /* Specify that the DOMAINNAME message catalog will be found 00104 in DIRNAME rather than in the system locale data base. */ 00105 extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname, 00106 const char *__dirname)); 00107 00108 /* Specify the character encoding in which the messages from the 00109 DOMAINNAME message catalog will be returned. */ 00110 extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, 00111 const char *__codeset)); 00112 00113 00114 /* Optimized version of the functions above. */ 00115 #if defined __OPTIMIZED 00116 /* These are macros, but could also be inline functions. */ 00117 00118 # define gettext(msgid) \ 00119 dgettext (NULL, msgid) 00120 00121 # define dgettext(domainname, msgid) \ 00122 dcgettext (domainname, msgid, LC_MESSAGES) 00123 00124 # define ngettext(msgid1, msgid2, n) \ 00125 dngettext (NULL, msgid1, msgid2, n) 00126 00127 # define dngettext(domainname, msgid1, msgid2, n) \ 00128 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) 00129 00130 #endif /* Optimizing. */ 00131 00132 00133 #ifdef __cplusplus 00134 } 00135 #endif 00136 00137 #endif /* libintl.h */