libgnuintl.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* Message catalogs for internationalization.
  2. Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef _LIBINTL_H
  15. #define _LIBINTL_H 1
  16. #include <locale.h>
  17. /* The LC_MESSAGES locale category is the category used by the functions
  18. gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
  19. On systems that don't define it, use an arbitrary value instead.
  20. On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e.
  21. this file!) and then only defines LC_MESSAGES. To avoid a redefinition
  22. warning, don't define LC_MESSAGES in this case. */
  23. #if !defined LC_MESSAGES && !defined __LOCALE_H
  24. # define LC_MESSAGES 1729
  25. #endif
  26. /* We define an additional symbol to signal that we use the GNU
  27. implementation of gettext. */
  28. #define __USE_GNU_GETTEXT 1
  29. /* Resolve a platform specific conflict on DJGPP. GNU gettext takes
  30. precedence over _conio_gettext. */
  31. #ifdef __DJGPP__
  32. # undef gettext
  33. # define gettext gettext
  34. #endif
  35. #ifndef PARAMS
  36. # if __STDC__ || defined __cplusplus
  37. # define PARAMS(args) args
  38. # else
  39. # define PARAMS(args) ()
  40. # endif
  41. #endif
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. /* Look up MSGID in the current default message catalog for the current
  46. LC_MESSAGES locale. If not found, returns MSGID itself (the default
  47. text). */
  48. extern char *gettext PARAMS ((const char *__msgid));
  49. /* Look up MSGID in the DOMAINNAME message catalog for the current
  50. LC_MESSAGES locale. */
  51. extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
  52. /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
  53. locale. */
  54. extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
  55. int __category));
  56. /* Similar to `gettext' but select the plural form corresponding to the
  57. number N. */
  58. extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
  59. unsigned long int __n));
  60. /* Similar to `dgettext' but select the plural form corresponding to the
  61. number N. */
  62. extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1,
  63. const char *__msgid2, unsigned long int __n));
  64. /* Similar to `dcgettext' but select the plural form corresponding to the
  65. number N. */
  66. extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1,
  67. const char *__msgid2, unsigned long int __n,
  68. int __category));
  69. /* Set the current default message catalog to DOMAINNAME.
  70. If DOMAINNAME is null, return the current default.
  71. If DOMAINNAME is "", reset to the default of "messages". */
  72. extern char *textdomain PARAMS ((const char *__domainname));
  73. /* Specify that the DOMAINNAME message catalog will be found
  74. in DIRNAME rather than in the system locale data base. */
  75. extern char *bindtextdomain PARAMS ((const char *__domainname,
  76. const char *__dirname));
  77. /* Specify the character encoding in which the messages from the
  78. DOMAINNAME message catalog will be returned. */
  79. extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
  80. const char *__codeset));
  81. /* Optimized version of the functions above. */
  82. #if defined __OPTIMIZED
  83. /* These are macros, but could also be inline functions. */
  84. # define gettext(msgid) \
  85. dgettext (NULL, msgid)
  86. # define dgettext(domainname, msgid) \
  87. dcgettext (domainname, msgid, LC_MESSAGES)
  88. # define ngettext(msgid1, msgid2, n) \
  89. dngettext (NULL, msgid1, msgid2, n)
  90. # define dngettext(domainname, msgid1, msgid2, n) \
  91. dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
  92. #endif /* Optimizing. */
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif /* libintl.h */