Back to index

glibc  2.9
libintl.h
Go to the documentation of this file.
00001 /* Message catalogs for internationalization.
00002    Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    This file is derived from the file libgettext.h in the GNU gettext package.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _LIBINTL_H
00022 #define _LIBINTL_H   1
00023 
00024 #include <features.h>
00025 
00026 /* We define an additional symbol to signal that we use the GNU
00027    implementation of gettext.  */
00028 #define __USE_GNU_GETTEXT 1
00029 
00030 /* Provide information about the supported file formats.  Returns the
00031    maximum minor revision number supported for a given major revision.  */
00032 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
00033   ((major) == 0 ? 1 : -1)
00034 
00035 __BEGIN_DECLS
00036 
00037 /* Look up MSGID in the current default message catalog for the current
00038    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
00039    text).  */
00040 extern char *gettext (__const char *__msgid)
00041      __THROW __attribute_format_arg__ (1);
00042 
00043 /* Look up MSGID in the DOMAINNAME message catalog for the current
00044    LC_MESSAGES locale.  */
00045 extern char *dgettext (__const char *__domainname, __const char *__msgid)
00046      __THROW __attribute_format_arg__ (2);
00047 extern char *__dgettext (__const char *__domainname, __const char *__msgid)
00048      __THROW __attribute_format_arg__ (2);
00049 
00050 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
00051    locale.  */
00052 extern char *dcgettext (__const char *__domainname,
00053                      __const char *__msgid, int __category)
00054      __THROW __attribute_format_arg__ (2);
00055 extern char *__dcgettext (__const char *__domainname,
00056                        __const char *__msgid, int __category)
00057      __THROW __attribute_format_arg__ (2);
00058 
00059 
00060 /* Similar to `gettext' but select the plural form corresponding to the
00061    number N.  */
00062 extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
00063                      unsigned long int __n)
00064      __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
00065 
00066 /* Similar to `dgettext' but select the plural form corresponding to the
00067    number N.  */
00068 extern char *dngettext (__const char *__domainname, __const char *__msgid1,
00069                      __const char *__msgid2, unsigned long int __n)
00070      __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
00071 
00072 /* Similar to `dcgettext' but select the plural form corresponding to the
00073    number N.  */
00074 extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
00075                       __const char *__msgid2, unsigned long int __n,
00076                       int __category)
00077      __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
00078 
00079 
00080 /* Set the current default message catalog to DOMAINNAME.
00081    If DOMAINNAME is null, return the current default.
00082    If DOMAINNAME is "", reset to the default of "messages".  */
00083 extern char *textdomain (__const char *__domainname) __THROW;
00084 
00085 /* Specify that the DOMAINNAME message catalog will be found
00086    in DIRNAME rather than in the system locale data base.  */
00087 extern char *bindtextdomain (__const char *__domainname,
00088                           __const char *__dirname) __THROW;
00089 
00090 /* Specify the character encoding in which the messages from the
00091    DOMAINNAME message catalog will be returned.  */
00092 extern char *bind_textdomain_codeset (__const char *__domainname,
00093                                   __const char *__codeset) __THROW;
00094 
00095 
00096 /* Optimized version of the function above.  */
00097 #if defined __OPTIMIZE__ && !defined __cplusplus
00098 
00099 /* We need NULL for `gettext'.  */
00100 # define __need_NULL
00101 # include <stddef.h>
00102 
00103 /* We need LC_MESSAGES for `dgettext'.  */
00104 # include <locale.h>
00105 
00106 /* These must be macros.  Inlined functions are useless because the
00107    `__builtin_constant_p' predicate in dcgettext would always return
00108    false.  */
00109 
00110 # define gettext(msgid) dgettext (NULL, msgid)
00111 
00112 # define dgettext(domainname, msgid) \
00113   dcgettext (domainname, msgid, LC_MESSAGES)
00114 
00115 # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
00116 
00117 # define dngettext(domainname, msgid1, msgid2, n) \
00118   dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
00119 
00120 #endif /* Optimizing.  */
00121 
00122 __END_DECLS
00123 
00124 #endif /* libintl.h */