lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Message catalogs for internationalization. |
| 2 | Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | This file is derived from the file libgettext.h in the GNU gettext package. |
| 5 | |
| 6 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | modify it under the terms of the GNU Lesser General Public |
| 8 | License as published by the Free Software Foundation; either |
| 9 | version 2.1 of the License, or (at your option) any later version. |
| 10 | |
| 11 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | Lesser General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public |
| 17 | License along with the GNU C Library; if not, write to the Free |
| 18 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 19 | 02111-1307 USA. */ |
| 20 | |
| 21 | #ifndef _LIBINTL_H |
| 22 | #define _LIBINTL_H 1 |
| 23 | |
| 24 | #include <features.h> |
| 25 | |
| 26 | /* We define an additional symbol to signal that we use the GNU |
| 27 | implementation of gettext. */ |
| 28 | #define __USE_GNU_GETTEXT 1 |
| 29 | |
| 30 | /* Provide information about the supported file formats. Returns the |
| 31 | maximum minor revision number supported for a given major revision. */ |
| 32 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ |
| 33 | ((major) == 0 ? 1 : -1) |
| 34 | |
| 35 | __BEGIN_DECLS |
| 36 | |
| 37 | /* Look up MSGID in the current default message catalog for the current |
| 38 | LC_MESSAGES locale. If not found, returns MSGID itself (the default |
| 39 | text). */ |
| 40 | extern char *gettext (__const char *__msgid) |
| 41 | __THROW __attribute_format_arg__ (1); |
| 42 | |
| 43 | /* Look up MSGID in the DOMAINNAME message catalog for the current |
| 44 | LC_MESSAGES locale. */ |
| 45 | extern char *dgettext (__const char *__domainname, __const char *__msgid) |
| 46 | __THROW __attribute_format_arg__ (2); |
| 47 | #if 0 /* uClibc: disabled */ |
| 48 | extern char *__dgettext (__const char *__domainname, __const char *__msgid) |
| 49 | __THROW __attribute_format_arg__ (2); |
| 50 | #endif |
| 51 | |
| 52 | /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY |
| 53 | locale. */ |
| 54 | extern char *dcgettext (__const char *__domainname, |
| 55 | __const char *__msgid, int __category) |
| 56 | __THROW __attribute_format_arg__ (2); |
| 57 | #if 0 /* uClibc: disabled */ |
| 58 | extern char *__dcgettext (__const char *__domainname, |
| 59 | __const char *__msgid, int __category) |
| 60 | __THROW __attribute_format_arg__ (2); |
| 61 | #endif |
| 62 | |
| 63 | |
| 64 | /* Similar to `gettext' but select the plural form corresponding to the |
| 65 | number N. */ |
| 66 | extern char *ngettext (__const char *__msgid1, __const char *__msgid2, |
| 67 | unsigned long int __n) |
| 68 | __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2); |
| 69 | |
| 70 | /* Similar to `dgettext' but select the plural form corresponding to the |
| 71 | number N. */ |
| 72 | extern char *dngettext (__const char *__domainname, __const char *__msgid1, |
| 73 | __const char *__msgid2, unsigned long int __n) |
| 74 | __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); |
| 75 | |
| 76 | /* Similar to `dcgettext' but select the plural form corresponding to the |
| 77 | number N. */ |
| 78 | extern char *dcngettext (__const char *__domainname, __const char *__msgid1, |
| 79 | __const char *__msgid2, unsigned long int __n, |
| 80 | int __category) |
| 81 | __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); |
| 82 | |
| 83 | |
| 84 | /* Set the current default message catalog to DOMAINNAME. |
| 85 | If DOMAINNAME is null, return the current default. |
| 86 | If DOMAINNAME is "", reset to the default of "messages". */ |
| 87 | extern char *textdomain (__const char *__domainname) __THROW; |
| 88 | |
| 89 | /* Specify that the DOMAINNAME message catalog will be found |
| 90 | in DIRNAME rather than in the system locale data base. */ |
| 91 | extern char *bindtextdomain (__const char *__domainname, |
| 92 | __const char *__dirname) __THROW; |
| 93 | |
| 94 | /* Specify the character encoding in which the messages from the |
| 95 | DOMAINNAME message catalog will be returned. */ |
| 96 | extern char *bind_textdomain_codeset (__const char *__domainname, |
| 97 | __const char *__codeset) __THROW; |
| 98 | |
| 99 | |
| 100 | /* Optimized version of the function above. */ |
| 101 | #if defined __OPTIMIZE__ && !defined __cplusplus |
| 102 | |
| 103 | /* We need NULL for `gettext'. */ |
| 104 | # define __need_NULL |
| 105 | # include <stddef.h> |
| 106 | |
| 107 | /* We need LC_MESSAGES for `dgettext'. */ |
| 108 | # include <locale.h> |
| 109 | |
| 110 | /* These must be macros. Inlined functions are useless because the |
| 111 | `__builtin_constant_p' predicate in dcgettext would always return |
| 112 | false. */ |
| 113 | |
| 114 | # define gettext(msgid) dgettext (NULL, msgid) |
| 115 | |
| 116 | # define dgettext(domainname, msgid) \ |
| 117 | dcgettext (domainname, msgid, LC_MESSAGES) |
| 118 | |
| 119 | # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) |
| 120 | |
| 121 | # define dngettext(domainname, msgid1, msgid2, n) \ |
| 122 | dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) |
| 123 | |
| 124 | #endif /* Optimizing. */ |
| 125 | |
| 126 | __END_DECLS |
| 127 | |
| 128 | #endif /* libintl.h */ |