blob: 96f9d955d114667dde9c6285f46d9717dffc582e [file] [log] [blame]
Theodore Ts'o5bc5a892000-02-08 20:20:46 +00001/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
2 Library.
Theodore Ts'ob0cacab2004-11-30 19:00:19 -05003 Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
Theodore Ts'o5bc5a892000-02-08 20:20:46 +00004
Theodore Ts'oa04eba32003-05-03 16:35:17 -04005 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published
7 by the Free Software Foundation; either version 2, or (at your option)
8 any later version.
Theodore Ts'o5bc5a892000-02-08 20:20:46 +00009
Theodore Ts'oa04eba32003-05-03 16:35:17 -040010 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000014
Theodore Ts'oa04eba32003-05-03 16:35:17 -040015 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 USA. */
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000019
20#ifdef HAVE_CONFIG_H
21# include <config.h>
22#endif
23
Theodore Ts'oa04eba32003-05-03 16:35:17 -040024#include "gettextP.h"
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000025
26/* @@ end of prolog @@ */
27
Theodore Ts'oa04eba32003-05-03 16:35:17 -040028/* This file redirects the gettext functions (without prefix) to those
29 defined in the included GNU libintl library (with "libintl_" prefix).
30 It is compiled into libintl in order to make the AM_GNU_GETTEXT test
31 of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050032 has the redirections primarily in the <libintl.h> include file.
33 It is also compiled into libgnuintl so that libgnuintl.so can be used
34 as LD_PRELOADable library on glibc systems, to provide the extra
35 features that the functions in the libc don't have (namely, logging). */
Theodore Ts'oa04eba32003-05-03 16:35:17 -040036
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000037
38#undef gettext
39#undef dgettext
40#undef dcgettext
Theodore Ts'oa04eba32003-05-03 16:35:17 -040041#undef ngettext
42#undef dngettext
43#undef dcngettext
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000044#undef textdomain
45#undef bindtextdomain
Theodore Ts'oa04eba32003-05-03 16:35:17 -040046#undef bind_textdomain_codeset
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000047
48
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050049/* When building a DLL, we must export some functions. Note that because
50 the functions are only defined for binary backward compatibility, we
51 don't need to use __declspec(dllimport) in any case. */
52#if defined _MSC_VER && BUILDING_DLL
53# define DLL_EXPORTED __declspec(dllexport)
54#else
55# define DLL_EXPORTED
56#endif
57
58
59DLL_EXPORTED
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000060char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050061gettext (const char *msgid)
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000062{
Theodore Ts'oa04eba32003-05-03 16:35:17 -040063 return libintl_gettext (msgid);
64}
65
66
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050067DLL_EXPORTED
Theodore Ts'oa04eba32003-05-03 16:35:17 -040068char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050069dgettext (const char *domainname, const char *msgid)
Theodore Ts'oa04eba32003-05-03 16:35:17 -040070{
71 return libintl_dgettext (domainname, msgid);
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000072}
73
74
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050075DLL_EXPORTED
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000076char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050077dcgettext (const char *domainname, const char *msgid, int category)
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000078{
Theodore Ts'oa04eba32003-05-03 16:35:17 -040079 return libintl_dcgettext (domainname, msgid, category);
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000080}
81
82
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050083DLL_EXPORTED
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000084char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050085ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
Theodore Ts'oa04eba32003-05-03 16:35:17 -040086{
87 return libintl_ngettext (msgid1, msgid2, n);
88}
89
90
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050091DLL_EXPORTED
Theodore Ts'oa04eba32003-05-03 16:35:17 -040092char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -050093dngettext (const char *domainname,
94 const char *msgid1, const char *msgid2, unsigned long int n)
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000095{
Theodore Ts'oa04eba32003-05-03 16:35:17 -040096 return libintl_dngettext (domainname, msgid1, msgid2, n);
Theodore Ts'o5bc5a892000-02-08 20:20:46 +000097}
98
99
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500100DLL_EXPORTED
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000101char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500102dcngettext (const char *domainname,
103 const char *msgid1, const char *msgid2, unsigned long int n,
104 int category)
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000105{
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400106 return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000107}
108
109
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500110DLL_EXPORTED
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000111char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500112textdomain (const char *domainname)
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000113{
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400114 return libintl_textdomain (domainname);
115}
116
117
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500118DLL_EXPORTED
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400119char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500120bindtextdomain (const char *domainname, const char *dirname)
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400121{
122 return libintl_bindtextdomain (domainname, dirname);
123}
124
125
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500126DLL_EXPORTED
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400127char *
Theodore Ts'ob0cacab2004-11-30 19:00:19 -0500128bind_textdomain_codeset (const char *domainname, const char *codeset)
Theodore Ts'oa04eba32003-05-03 16:35:17 -0400129{
130 return libintl_bind_textdomain_codeset (domainname, codeset);
Theodore Ts'o5bc5a892000-02-08 20:20:46 +0000131}