ctf-intl.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* ctf-intl.h - libctf specific header for gettext code.
  2. Copyright (C) 1998-2022 Free Software Foundation, Inc.
  3. Written by Tom Tromey <tromey@cygnus.com>
  4. This file is part of libctf.
  5. This library is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. It is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this file; see the file COPYING. If not, write to the
  15. Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA. */
  17. #ifndef _CTF_INTL_H
  18. #define _CTF_INTL_H
  19. #ifdef ENABLE_NLS
  20. # include <libintl.h>
  21. /* Note the redefinition of gettext and ngettext here to use PACKAGE.
  22. This is because the code in this directory is used to build a
  23. library which will be linked with code in other directories to form
  24. programs. We want to maintain a separate translation file for this
  25. directory however, rather than being forced to merge it with that
  26. of any program linked to libopcodes. This is a library, so it
  27. cannot depend on the catalog currently loaded.
  28. In order to do this, we have to make sure that when we extract
  29. messages we use the LIBCTF domain rather than the domain of the
  30. program that included the opcodes library, (eg OBJDUMP). Hence we
  31. use dgettext (PACKAGE, String) and define PACKAGE to be 'libctf'.
  32. (See the code in configure). */
  33. # undef gettext
  34. # define gettext(Msgid) dgettext (PACKAGE, Msgid)
  35. # undef ngettext
  36. # define ngettext(Msgid1, Msgid2, n) dngettext (PACKAGE, Msgid1, Msgid2, n)
  37. # define _(String) gettext (String)
  38. # ifdef gettext_noop
  39. # define N_(String) gettext_noop (String)
  40. # else
  41. # define N_(String) String
  42. # endif
  43. #else
  44. # define gettext(Msgid) (Msgid)
  45. # define dgettext(Domainname, Msgid) (Msgid)
  46. # define dcgettext(Domainname, Msgid, Category) (Msgid)
  47. # define ngettext(Msgid1, Msgid2, n) \
  48. (n == 1 ? Msgid1 : Msgid2)
  49. # define dngettext(Domainname, Msgid1, Msgid2, n) \
  50. (n == 1 ? Msgid1 : Msgid2)
  51. # define dcngettext(Domainname, Msgid1, Msgid2, n, Category) \
  52. (n == 1 ? Msgid1 : Msgid2)
  53. # define textdomain(Domainname) do {} while (0)
  54. # define bindtextdomain(Domainname, Dirname) do {} while (0)
  55. # define _(String) (String)
  56. # define N_(String) String
  57. #endif
  58. #endif /* _CTF_INTL_H */