libintl.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (C) 2008 Tor Lillqvist
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This 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. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; see the file COPYING.LIB.txt. If
  16. * not, write to the Free Software Foundation, Inc., 51 Franklin
  17. * Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef _LIBINTL_H
  20. #define _LIBINTL_H 1
  21. #include <locale.h>
  22. #ifndef LC_MESSAGES
  23. # define LC_MESSAGES 1729 /* Use same value as in GNU gettext */
  24. #endif
  25. /* Define this to make configure checks successfully find gettext in libintl.
  26. * This will cause the AM_GNU_GETTEXT([external]) macro to successfully detect
  27. * that gettext is in -lintl, not in libc, and needs #include <libintl.h> */
  28. #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
  29. # define __GNU_GETTEXT_SUPPORTED_REVISION
  30. #endif
  31. #if defined(__has_attribute)
  32. # define PROXY_LIBINTL_HAS_GNUC_FORMAT __has_attribute(__format_arg__)
  33. #else
  34. # define PROXY_LIBINTL_HAS_GNUC_FORMAT (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
  35. #endif
  36. #if PROXY_LIBINTL_HAS_GNUC_FORMAT
  37. # define PROXY_LIBINTL_GNUC_FORMAT(arg_idx) __attribute__((__format_arg__(arg_idx)))
  38. #else
  39. # define PROXY_LIBINTL_GNUC_FORMAT(arg_idx)
  40. #endif
  41. #define gettext g_libintl_gettext
  42. #define dgettext g_libintl_dgettext
  43. #define dcgettext g_libintl_dcgettext
  44. #define ngettext g_libintl_ngettext
  45. #define dngettext g_libintl_dngettext
  46. #define dcngettext g_libintl_dcngettext
  47. #define textdomain g_libintl_textdomain
  48. #define bindtextdomain g_libintl_bindtextdomain
  49. #define bind_textdomain_codeset g_libintl_bind_textdomain_codeset
  50. /* Define G_INTL_STATIC_COMPILATION to link statically */
  51. #if defined(_WIN32) && !defined(G_INTL_STATIC_COMPILATION)
  52. /* Export when producing library, import when linking against library */
  53. # ifdef G_INTL_COMPILATION
  54. # define G_INTL_EXPORT __declspec(dllexport)
  55. # elif defined(_MSC_VER)
  56. # define G_INTL_EXPORT __declspec(dllimport)
  57. # else
  58. # define G_INTL_EXPORT extern
  59. # endif
  60. #else
  61. # define G_INTL_EXPORT extern
  62. #endif
  63. #ifdef __cplusplus
  64. extern "C" {
  65. #endif
  66. G_INTL_EXPORT char *g_libintl_gettext (const char *msgid) PROXY_LIBINTL_GNUC_FORMAT (1);
  67. G_INTL_EXPORT char *g_libintl_dgettext (const char *domainname,
  68. const char *msgid) PROXY_LIBINTL_GNUC_FORMAT (2);
  69. G_INTL_EXPORT char *g_libintl_dcgettext (const char *domainname,
  70. const char *msgid,
  71. int category) PROXY_LIBINTL_GNUC_FORMAT (2);
  72. G_INTL_EXPORT char *g_libintl_ngettext (const char *msgid1,
  73. const char *msgid2,
  74. unsigned long int n) PROXY_LIBINTL_GNUC_FORMAT (1) PROXY_LIBINTL_GNUC_FORMAT (2);
  75. G_INTL_EXPORT char *g_libintl_dngettext (const char *domainname,
  76. const char *msgid1,
  77. const char *msgid2,
  78. unsigned long int n) PROXY_LIBINTL_GNUC_FORMAT (2) PROXY_LIBINTL_GNUC_FORMAT (3);
  79. G_INTL_EXPORT char *g_libintl_dcngettext (const char *domainname,
  80. const char *msgid1,
  81. const char *msgid2,
  82. unsigned long int n,
  83. int category) PROXY_LIBINTL_GNUC_FORMAT (2) PROXY_LIBINTL_GNUC_FORMAT (3);
  84. G_INTL_EXPORT char *g_libintl_textdomain (const char *domainname);
  85. G_INTL_EXPORT char *g_libintl_bindtextdomain (const char *domainname,
  86. const char *dirname);
  87. G_INTL_EXPORT char *g_libintl_bind_textdomain_codeset (const char *domainname,
  88. const char *codeset);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif /* _LIBINTL_H */