libintl.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. #ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
  21. /* We define an additional symbol to signal that we use the GNU
  22. implementation of gettext. */
  23. #define __USE_GNU_GETTEXT 1
  24. /* Provide information about the supported file formats. Returns the
  25. maximum minor revision number supported for a given major revision. */
  26. #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
  27. ((major) == 0 ? 1 : -1)
  28. __BEGIN_DECLS
  29. /* Look up MSGID in the current default message catalog for the current
  30. LC_MESSAGES locale. If not found, returns MSGID itself (the default
  31. text). */
  32. extern char *gettext (__const char *__msgid)
  33. __THROW __attribute_format_arg__ (1);
  34. /* Look up MSGID in the DOMAINNAME message catalog for the current
  35. LC_MESSAGES locale. */
  36. extern char *dgettext (__const char *__domainname, __const char *__msgid)
  37. __THROW __attribute_format_arg__ (2);
  38. #if 0 /* uClibc: disabled */
  39. extern char *__dgettext (__const char *__domainname, __const char *__msgid)
  40. __THROW __attribute_format_arg__ (2);
  41. #endif
  42. /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
  43. locale. */
  44. extern char *dcgettext (__const char *__domainname,
  45. __const char *__msgid, int __category)
  46. __THROW __attribute_format_arg__ (2);
  47. #if 0 /* uClibc: disabled */
  48. extern char *__dcgettext (__const char *__domainname,
  49. __const char *__msgid, int __category)
  50. __THROW __attribute_format_arg__ (2);
  51. #endif
  52. /* Similar to `gettext' but select the plural form corresponding to the
  53. number N. */
  54. extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
  55. unsigned long int __n)
  56. __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
  57. /* Similar to `dgettext' but select the plural form corresponding to the
  58. number N. */
  59. extern char *dngettext (__const char *__domainname, __const char *__msgid1,
  60. __const char *__msgid2, unsigned long int __n)
  61. __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
  62. /* Similar to `dcgettext' but select the plural form corresponding to the
  63. number N. */
  64. extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
  65. __const char *__msgid2, unsigned long int __n,
  66. int __category)
  67. __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
  68. /* Set the current default message catalog to DOMAINNAME.
  69. If DOMAINNAME is null, return the current default.
  70. If DOMAINNAME is "", reset to the default of "messages". */
  71. extern char *textdomain (__const char *__domainname) __THROW;
  72. /* Specify that the DOMAINNAME message catalog will be found
  73. in DIRNAME rather than in the system locale data base. */
  74. extern char *bindtextdomain (__const char *__domainname,
  75. __const char *__dirname) __THROW;
  76. /* Specify the character encoding in which the messages from the
  77. DOMAINNAME message catalog will be returned. */
  78. extern char *bind_textdomain_codeset (__const char *__domainname,
  79. __const char *__codeset) __THROW;
  80. /* Optimized version of the function above. */
  81. #if defined __OPTIMIZE__ && !defined __cplusplus
  82. /* We need NULL for `gettext'. */
  83. # define __need_NULL
  84. # include <stddef.h>
  85. /* We need LC_MESSAGES for `dgettext'. */
  86. # include <locale.h>
  87. /* These must be macros. Inlined functions are useless because the
  88. `__builtin_constant_p' predicate in dcgettext would always return
  89. false. */
  90. # define gettext(msgid) dgettext (NULL, msgid)
  91. # define dgettext(domainname, msgid) \
  92. dcgettext (domainname, msgid, LC_MESSAGES)
  93. # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
  94. # define dngettext(domainname, msgid1, msgid2, n) \
  95. dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
  96. #endif /* Optimizing. */
  97. __END_DECLS
  98. #endif /* __UCLIBC_HAS_GETTEXT_AWARENESS__ */
  99. #ifdef _LIBC
  100. # define _(x) x
  101. # define N_(x) x
  102. #endif
  103. #endif /* libintl.h */