diff options
Diffstat (limited to 'src/gettext.c')
-rw-r--r-- | src/gettext.c | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/gettext.c b/src/gettext.c deleted file mode 100644 index 9dcaf1c..0000000 --- a/src/gettext.c +++ /dev/null @@ -1,136 +0,0 @@ -/* This file is part of gettext interface for guile. - Copyright (C) 2004 Sergey Poznyakoff - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif -#include <gettext.h> -#include <libguile.h> -#include <locale.h> - -SCM_DEFINE (scm_bindtextdomain, "bindtextdomain", 2, 0, 0, - (SCM PACKAGENAME, SCM LOCALEDIR), - "") -#define FUNC_NAME s_scm_bindtextdomain -{ - SCM_ASSERT(SCM_STRINGP(PACKAGENAME), PACKAGENAME, SCM_ARG1, FUNC_NAME); - SCM_ASSERT(SCM_STRINGP(LOCALEDIR), LOCALEDIR, SCM_ARG2, FUNC_NAME); - bindtextdomain(SCM_CHARS(PACKAGENAME), SCM_CHARS(LOCALEDIR)); - return SCM_UNSPECIFIED; -} -#undef FUNC_NAME - -SCM_DEFINE (scm_bind_textdomain_codeset, "bind_textdomain_codeset", 1, 1, 0, - (SCM DOMAINNAME, SCM CODESET), - "") -#define FUNC_NAME s_scm_bind_textdomain_codeset -{ - char *codeset; - - SCM_ASSERT(SCM_STRINGP(DOMAINNAME), DOMAINNAME, SCM_ARG1, FUNC_NAME); - if (SCM_UNBNDP(CODESET)) - codeset = NULL; - else { - SCM_ASSERT(SCM_STRINGP(CODESET), CODESET, SCM_ARG2, FUNC_NAME); - codeset = SCM_CHARS(CODESET); - } - return scm_makfrom0str(bind_textdomain_codeset(SCM_CHARS(DOMAINNAME), - codeset)); -} -#undef FUNC_NAME - - -SCM_DEFINE (scm_textdomain, "textdomain", 1, 0, 0, - (SCM PACKAGENAME), - "") -#define FUNC_NAME s_scm_bindtextdomain -{ - SCM_ASSERT(SCM_STRINGP(PACKAGENAME), PACKAGENAME, SCM_ARG1, FUNC_NAME); - textdomain(SCM_CHARS(PACKAGENAME)); - return SCM_UNSPECIFIED; -} -#undef FUNC_NAME - -SCM_DEFINE (scm_gettext, "gettext", 1, 0, 0, - (SCM STRING), - "Return a translation of the given string.") -#define FUNC_NAME s_scm_gettext -{ - SCM_ASSERT(SCM_STRINGP(STRING), STRING, SCM_ARG1, FUNC_NAME); - return scm_makfrom0str(gettext(SCM_CHARS(STRING))); -} -#undef FUNC_NAME - -SCM_DEFINE (scm_dgettext, "dgettext", 2, 0, 0, - (SCM DOMAIN, SCM STRING), - "Return a translation of the given string within the given domain.") -#define FUNC_NAME s_scm_dgettext -{ - SCM_ASSERT(SCM_STRINGP(DOMAIN), DOMAIN, SCM_ARG1, FUNC_NAME); - SCM_ASSERT(SCM_STRINGP(STRING), STRING, SCM_ARG2, FUNC_NAME); - return scm_makfrom0str(dgettext(SCM_CHARS(DOMAIN), SCM_CHARS(STRING))); -} -#undef FUNC_NAME - -SCM_DEFINE (scm_ngettext, "ngettext", 3, 0, 0, - (SCM MSGID1, SCM MSGID2, SCM N), - "The `ngettext' function is used to translate messages that " - "have singular and plural forms. The MSGID1 parameter must " - "contain the singular form of the string to be converted. It is " - "also used as the key for the search in the catalog. The " - "MSGID2 parameter is the plural form. The parameter N " - "is used to determine the plural form. If no message catalog is " - "found MSGID1 is returned if `N == 1', otherwise MSGID2.") -#define FUNC_NAME s_scm_ngettext -{ - SCM_ASSERT(SCM_STRINGP(MSGID1), MSGID1, SCM_ARG1, FUNC_NAME); - SCM_ASSERT(SCM_STRINGP(MSGID2), MSGID2, SCM_ARG2, FUNC_NAME); - SCM_ASSERT(SCM_IMP(N) && SCM_INUMP(N), N, SCM_ARG3, FUNC_NAME); - return scm_makfrom0str(ngettext(SCM_CHARS(MSGID1), SCM_CHARS(MSGID2), - SCM_INUM(N))); -} -#undef FUNC_NAME - -SCM_DEFINE (scm_dngettext, "dngettext", 4, 0, 0, - (SCM DOMAIN, SCM MSGID1, SCM MSGID2, SCM N), - "The `dngettext' function is used to translate messages that " - "have singular and plural forms. The MSGID1 parameter must " - "contain the singular form of the string to be converted. It is " - "also used as the key for the search in the catalog. The " - "MSGID2 parameter is the plural form. The parameter N " - "is used to determine the plural form. If no message catalog is " - "found MSGID1 is returned if `N == 1', otherwise MSGID2.") -#define FUNC_NAME s_scm_dngettext -{ - SCM_ASSERT(SCM_STRINGP(DOMAIN), DOMAIN, SCM_ARG1, FUNC_NAME); - SCM_ASSERT(SCM_STRINGP(MSGID1), MSGID1, SCM_ARG2, FUNC_NAME); - SCM_ASSERT(SCM_STRINGP(MSGID2), MSGID2, SCM_ARG3, FUNC_NAME); - SCM_ASSERT(SCM_IMP(N) && SCM_INUMP(N), N, SCM_ARG4, FUNC_NAME); - return scm_makfrom0str(dngettext(SCM_CHARS(DOMAIN), - SCM_CHARS(MSGID1), - SCM_CHARS(MSGID2), - SCM_INUM(N))); -} -#undef FUNC_NAME - -extern void -gettext_init() -{ -#ifndef SCM_MAGIC_SNARFER -# include <gettext.x> -#endif -} |