libintl.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library 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. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #ifndef _LIBINTL_H
  18. #define _LIBINTL_H 1
  19. #include <features.h>
  20. /* We define an additional symbol to signal that we use the GNU
  21. implementation of gettext. */
  22. #define __USE_GNU_GETTEXT 1
  23. /* Provide information about the supported file formats. Returns the
  24. maximum minor revision number supported for a given major revision. */
  25. #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
  26. ((major) == 0 ? 1 : -1)
  27. __BEGIN_DECLS
  28. #ifdef __UCLIBC_MJN3_ONLY__
  29. #warning "mjn3 FIXME: gettext has a prototype but isn't defined."
  30. #warning "mjn3 FIXME: __OPTIMIZE__ is never defined."
  31. #endif
  32. /* Look up MSGID in the current default message catalog for the current
  33. LC_MESSAGES locale. If not found, returns MSGID itself (the default
  34. text). */
  35. extern char *gettext (__const char *__msgid)
  36. __THROW __attribute_format_arg__ (1);
  37. /* Look up MSGID in the DOMAINNAME message catalog for the current
  38. LC_MESSAGES locale. */
  39. extern char *dgettext (__const char *__domainname, __const char *__msgid)
  40. __THROW __attribute_format_arg__ (2);
  41. #if 0 /* uClibc: disabled */
  42. extern char *__dgettext (__const char *__domainname, __const char *__msgid)
  43. __THROW __attribute_format_arg__ (2);
  44. #endif
  45. /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
  46. locale. */
  47. extern char *dcgettext (__const char *__domainname,
  48. __const char *__msgid, int __category)
  49. __THROW __attribute_format_arg__ (2);
  50. #if 0 /* uClibc: disabled */
  51. extern char *__dcgettext (__const char *__domainname,
  52. __const char *__msgid, int __category)
  53. __THROW __attribute_format_arg__ (2);
  54. #endif
  55. /* Similar to `gettext' but select the plural form corresponding to the
  56. number N. */
  57. extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
  58. unsigned long int __n)
  59. __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
  60. /* Similar to `dgettext' but select the plural form corresponding to the
  61. number N. */
  62. extern char *dngettext (__const char *__domainname, __const char *__msgid1,
  63. __const char *__msgid2, unsigned long int __n)
  64. __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
  65. /* Similar to `dcgettext' but select the plural form corresponding to the
  66. number N. */
  67. extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
  68. __const char *__msgid2, unsigned long int __n,
  69. int __category)
  70. __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
  71. /* Set the current default message catalog to DOMAINNAME.
  72. If DOMAINNAME is null, return the current default.
  73. If DOMAINNAME is "", reset to the default of "messages". */
  74. extern char *textdomain (__const char *__domainname) __THROW;
  75. /* Specify that the DOMAINNAME message catalog will be found
  76. in DIRNAME rather than in the system locale data base. */
  77. extern char *bindtextdomain (__const char *__domainname,
  78. __const char *__dirname) __THROW;
  79. /* Specify the character encoding in which the messages from the
  80. DOMAINNAME message catalog will be returned. */
  81. extern char *bind_textdomain_codeset (__const char *__domainname,
  82. __const char *__codeset) __THROW;
  83. /* Optimized version of the function above. */
  84. #if defined __OPTIMIZE__ && !defined __cplusplus
  85. /* We need NULL for `gettext'. */
  86. # define __need_NULL
  87. # include <stddef.h>
  88. /* We need LC_MESSAGES for `dgettext'. */
  89. # include <locale.h>
  90. /* These must be macros. Inlined functions are useless because the
  91. `__builtin_constant_p' predicate in dcgettext would always return
  92. false. */
  93. # define gettext(msgid) dgettext (NULL, msgid)
  94. # define dgettext(domainname, msgid) \
  95. dcgettext (domainname, msgid, LC_MESSAGES)
  96. # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
  97. # define dngettext(domainname, msgid1, msgid2, n) \
  98. dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
  99. #endif /* Optimizing. */
  100. __END_DECLS
  101. #endif /* libintl.h */