From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruno Haible Newsgroups: gmane.lisp.guile.devel Subject: Re: i18n, gettext support Date: Sat, 4 Sep 2004 19:25:15 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <200409041925.15048.bruno@clisp.org> References: <200408202226.10769.bruno@clisp.org> <200409021821.13800.bruno@clisp.org> <87d614b0fq.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_7pfOBJxYfrKD/sY" X-Trace: sea.gmane.org 1094318978 10156 80.91.224.253 (4 Sep 2004 17:29:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2004 17:29:38 +0000 (UTC) Cc: guile-devel@gnu.org, Jan Nieuwenhuizen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Sep 04 19:29:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C3eLq-0004OT-00 for ; Sat, 04 Sep 2004 19:29:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C3eQu-0004Gj-Bq for guile-devel@m.gmane.org; Sat, 04 Sep 2004 13:34:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C3eQm-0004Ge-QL for guile-devel@gnu.org; Sat, 04 Sep 2004 13:34:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C3eQl-0004GS-Tf for guile-devel@gnu.org; Sat, 04 Sep 2004 13:34:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C3eQl-0004GP-PV for guile-devel@gnu.org; Sat, 04 Sep 2004 13:34:27 -0400 Original-Received: from [81.80.162.195] (helo=ftp.ilog.fr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C3eLH-0002lG-IM; Sat, 04 Sep 2004 13:28:48 -0400 Original-Received: from laposte.ilog.fr (cerbere-qe0 [81.80.162.193]) by ftp.ilog.fr (8.13.1/8.13.0) with ESMTP id i84HSivF018594; Sat, 4 Sep 2004 19:28:45 +0200 (MET DST) Original-Received: from honolulu.ilog.fr ([172.16.15.121]) by laposte.ilog.fr (8.13.1/8.13.1) with ESMTP id i84HSbSl021005; Sat, 4 Sep 2004 19:28:37 +0200 (MET DST) Original-Received: from localhost (localhost [127.0.0.1]) by honolulu.ilog.fr (Postfix) with ESMTP id 03D6C3B37F; Sat, 4 Sep 2004 17:25:16 +0000 (UTC) Original-To: Kevin Ryde User-Agent: KMail/1.5 In-Reply-To: <87d614b0fq.fsf@zip.com.au> X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:4076 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4076 --Boundary-00=_7pfOBJxYfrKD/sY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Kevin Ryde wrote: > LC_MESSAGES and friends already exist as variables. OK. Find attached a revised patch which takes this into account. > > + SCM_API SCM scm_get_textdomain (void); > > + SCM_API SCM scm_set_textdomain (SCM domainname); > > I think these could be a single textdomain func taking an optional > argument. That's what's done for setlocale for instance, and it > matches the C routines. > > > + SCM_API SCM scm_get_textdomain_dir (SCM domainname); > > + SCM_API SCM scm_set_textdomain_dir (SCM domainname, SCM directory); > > + SCM_API SCM scm_get_textdomain_codeset (SCM domainname); > > + SCM_API SCM scm_set_textdomain_codeset (SCM domainname, SCM encoding); > > And I'd call these bindtextdomain, again for similarity to the C > routines they wrap. > > > + SCM_VARIABLE_SET (gettersym, > > + scm_make_procedure_with_setter ( > > + SCM_VARIABLE_REF (gettersym), > > + SCM_VARIABLE_REF (settersym))); > > Procedures with setters are not much used in the core. That's your point of view, not mine. I would find it irresponsible if I were to submit a patch which includes destructive functions that don't bear a '!' in their name. You and/or Jan can of course spend 15 minutes to modify my patch to fit your point of view. In the GNU 'xgettext' extractor and associated example I will support whatever API you provide in guile. Bruno --Boundary-00=_7pfOBJxYfrKD/sY Content-Type: text/x-diff; charset="iso-8859-1"; name="guile-diffs" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="guile-diffs" ChangeLog: 2004-09-02 Bruno Haible * configure.in: Add AM_GNU_GETTEXT invocation. libguile/ChangeLog: 2004-09-04 Jan Nieuwenhuizen Bruno Haible * i18n.h: New file. * i18n.c: New file. * gettext.h: New file, taken from GNU gettext. * init.c: Include libguile/i18n.h. (scm_init_guile_1): Add call to scm_init_i18n(). * Makefile.am (libguile_la_SOURCES): Add i18n.c. (DOT_X_FILES): Add i18n.x. (DOT_DOC_FILES): Add i18n.doc. (libguile_la_LDFLAGS): Add @LTLIBINTL@. (modinclude_HEADERS): Add i18n.h. diff -r -c3 --exclude=Makefile --exclude='*.texi' --exclude='*.info*' --exclude=configure --exclude=Makefile.in guile-1.7.1.orig/configure.in guile-1.7.1/configure.in *** guile-1.7.1.orig/configure.in 2004-08-26 16:23:34.000000000 +0200 --- guile-1.7.1/configure.in 2004-09-01 22:05:51.000000000 +0200 *************** *** 637,642 **** --- 637,645 ---- [mpz_import (0, 0, 0, 0, 0, 0, 0);] , , [AC_MSG_ERROR([At least GNU MP 4.1 is required, see http://swox.com/gmp])]) + dnl i18n tests + AM_GNU_GETTEXT([external], [need-ngettext]) + ### Some systems don't declare some functions. On such systems, we ### need to at least provide our own K&R-style declarations. diff -r -c3 --exclude=Makefile --exclude='*.texi' --exclude='*.info*' --exclude=configure --exclude=Makefile.in guile-1.7.1.orig/libguile/init.c guile-1.7.1/libguile/init.c *** guile-1.7.1.orig/libguile/init.c 2004-08-25 11:45:13.000000000 +0200 --- guile-1.7.1/libguile/init.c 2004-09-02 13:43:11.000000000 +0200 *************** *** 63,68 **** --- 63,69 ---- #include "libguile/hash.h" #include "libguile/hashtab.h" #include "libguile/hooks.h" + #include "libguile/i18n.h" #include "libguile/iselect.h" #include "libguile/ioext.h" #include "libguile/keywords.h" *************** *** 477,482 **** --- 478,484 ---- scm_init_properties (); scm_init_hooks (); /* Requires smob_prehistory */ scm_init_gc (); /* Requires hooks, async */ + scm_init_i18n (); scm_init_ioext (); scm_init_keywords (); scm_init_list (); diff -r -c3 --exclude=Makefile --exclude='*.texi' --exclude='*.info*' --exclude=configure --exclude=Makefile.in guile-1.7.1.orig/libguile/Makefile.am guile-1.7.1/libguile/Makefile.am *** guile-1.7.1.orig/libguile/Makefile.am 2004-08-25 11:45:10.000000000 +0200 --- guile-1.7.1/libguile/Makefile.am 2004-09-02 17:47:55.000000000 +0200 *************** *** 97,103 **** gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c gc-freelist.c \ gc_os_dep.c gdbint.c gh_data.c gh_eval.c gh_funcs.c gh_init.c \ gh_io.c gh_list.c gh_predicates.c goops.c gsubr.c guardians.c hash.c \ ! hashtab.c hooks.c init.c inline.c ioext.c keywords.c \ lang.c list.c \ load.c macros.c mallocs.c modules.c numbers.c objects.c objprop.c \ options.c pairs.c ports.c print.c procprop.c procs.c properties.c \ --- 97,103 ---- gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c gc-freelist.c \ gc_os_dep.c gdbint.c gh_data.c gh_eval.c gh_funcs.c gh_init.c \ gh_io.c gh_list.c gh_predicates.c goops.c gsubr.c guardians.c hash.c \ ! hashtab.c hooks.c i18n.c init.c inline.c ioext.c keywords.c \ lang.c list.c \ load.c macros.c mallocs.c modules.c numbers.c objects.c objprop.c \ options.c pairs.c ports.c print.c procprop.c procs.c properties.c \ *************** *** 113,119 **** error.x eval.x evalext.x extensions.x feature.x fluids.x fports.x \ futures.x \ gc.x gc-mark.x gc-segment.x gc-malloc.x gc-card.x goops.x \ ! gsubr.x guardians.x hash.x hashtab.x hooks.x init.x ioext.x \ keywords.x lang.x list.x load.x macros.x mallocs.x modules.x \ numbers.x objects.x objprop.x options.x pairs.x ports.x print.x \ procprop.x procs.x properties.x random.x rdelim.x read.x root.x rw.x \ --- 113,119 ---- error.x eval.x evalext.x extensions.x feature.x fluids.x fports.x \ futures.x \ gc.x gc-mark.x gc-segment.x gc-malloc.x gc-card.x goops.x \ ! gsubr.x guardians.x hash.x hashtab.x hooks.x i18n.x init.x ioext.x \ keywords.x lang.x list.x load.x macros.x mallocs.x modules.x \ numbers.x objects.x objprop.x options.x pairs.x ports.x print.x \ procprop.x procs.x properties.x random.x rdelim.x read.x root.x rw.x \ *************** *** 132,139 **** extensions.doc feature.doc fluids.doc fports.doc futures.doc \ gc.doc goops.doc \ gsubr.doc gc-mark.doc gc-segment.doc gc-malloc.doc gc-card.doc \ ! guardians.doc hash.doc hashtab.doc hooks.doc init.doc ioext.doc \ ! keywords.doc lang.doc list.doc load.doc macros.doc \ mallocs.doc modules.doc numbers.doc objects.doc objprop.doc \ options.doc pairs.doc ports.doc print.doc procprop.doc \ procs.doc properties.doc random.doc rdelim.doc read.doc root.doc rw.doc \ --- 132,139 ---- extensions.doc feature.doc fluids.doc fports.doc futures.doc \ gc.doc goops.doc \ gsubr.doc gc-mark.doc gc-segment.doc gc-malloc.doc gc-card.doc \ ! guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc \ ! ioext.doc keywords.doc lang.doc list.doc load.doc macros.doc \ mallocs.doc modules.doc numbers.doc objects.doc objprop.doc \ options.doc pairs.doc ports.doc print.doc procprop.doc \ procs.doc properties.doc random.doc rdelim.doc read.doc root.doc rw.doc \ *************** *** 172,178 **** libguile_la_DEPENDENCIES = @LIBLOBJS@ libguile_la_LIBADD = @LIBLOBJS@ ../libguile-ltdl/libguile-ltdl.la $(THREAD_LIBS_LOCAL) ! libguile_la_LDFLAGS = -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined # These are headers visible as pkginclude_HEADERS = gh.h --- 172,178 ---- libguile_la_DEPENDENCIES = @LIBLOBJS@ libguile_la_LIBADD = @LIBLOBJS@ ../libguile-ltdl/libguile-ltdl.la $(THREAD_LIBS_LOCAL) ! libguile_la_LDFLAGS = @LTLIBINTL@ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined # These are headers visible as pkginclude_HEADERS = gh.h *************** *** 187,193 **** error.h eval.h \ evalext.h extensions.h feature.h filesys.h fluids.h fports.h futures.h \ gc.h gdb_interface.h gdbint.h \ ! goops.h gsubr.h guardians.h hash.h hashtab.h hooks.h init.h \ inline.h ioext.h \ iselect.h keywords.h lang.h list.h load.h macros.h mallocs.h modules.h \ net_db.h numbers.h objects.h objprop.h options.h pairs.h ports.h posix.h \ --- 187,193 ---- error.h eval.h \ evalext.h extensions.h feature.h filesys.h fluids.h fports.h futures.h \ gc.h gdb_interface.h gdbint.h \ ! goops.h gsubr.h guardians.h hash.h hashtab.h hooks.h i18n.h init.h \ inline.h ioext.h \ iselect.h keywords.h lang.h list.h load.h macros.h mallocs.h modules.h \ net_db.h numbers.h objects.h objprop.h options.h pairs.h ports.h posix.h \ *** /dev/null 1970-01-01 01:00:00.000000000 +0100 --- guile-1.7.1/libguile/i18n.h 2004-09-02 14:05:22.000000000 +0200 *************** *** 0 **** --- 1,41 ---- + /* classes: h_files */ + + #ifndef SCM_I18N_H + #define SCM_I18N_H + + /* Copyright (C) 2004 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + #include "libguile/__scm.h" + + SCM_API SCM scm_gettext (SCM msgid, SCM domainname, SCM category); + SCM_API SCM scm_ngettext (SCM msgid, SCM msgid_plural, SCM n, SCM domainname, SCM category); + SCM_API SCM scm_get_textdomain (void); + SCM_API SCM scm_set_textdomain (SCM domainname); + SCM_API SCM scm_get_textdomain_dir (SCM domainname); + SCM_API SCM scm_set_textdomain_dir (SCM domainname, SCM directory); + SCM_API SCM scm_get_textdomain_codeset (SCM domainname); + SCM_API SCM scm_set_textdomain_codeset (SCM domainname, SCM encoding); + SCM_API void scm_init_i18n (void); + + #endif /* SCM_I18N_H */ + + /* + Local Variables: + c-file-style: "gnu" + End: + */ *** /dev/null 1970-01-01 01:00:00.000000000 +0100 --- guile-1.7.1/libguile/i18n.c 2004-09-04 19:10:24.000000000 +0200 *************** *** 0 **** --- 1,323 ---- + /* Copyright (C) 2004 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + #if HAVE_CONFIG_H + # include + #endif + + #include "libguile/_scm.h" + #include "libguile/discouraged.h" + #include "libguile/feature.h" + #include "libguile/i18n.h" + #include "libguile/strings.h" + #include "gettext.h" + #include + + + static int + scm_validate_category (SCM category, const char *subr, int pos) + { + if (scm_is_eq (category, scm_from_int (LC_MESSAGES)) + || scm_is_eq (category, scm_from_int (LC_CTYPE)) + || scm_is_eq (category, scm_from_int (LC_TIME)) + || scm_is_eq (category, scm_from_int (LC_COLLATE)) + || scm_is_eq (category, scm_from_int (LC_MONETARY))) + return scm_to_int (category); + else + scm_wrong_type_arg (subr, pos, category); + } + + + SCM_DEFINE (scm_gettext, "gettext", 1, 2, 0, + (SCM msgid, SCM domain, SCM category), + "Return the translation of @var{msgid} in the message domain " + "@var{domain}. @var{domain} is optional and defaults to the " + "domain set through (textdomain). @var{category} is optional " + "and defaults to LC_MESSAGES.") + #define FUNC_NAME s_scm_gettext + { + char *c_msgid; + const char *result; + + SCM_VALIDATE_STRING (1, msgid); + c_msgid = scm_to_locale_string (msgid); + if (SCM_UNBNDP (domain)) + { + /* 1 argument case. */ + result = gettext (c_msgid); + } + else + { + char *c_domain; + + SCM_VALIDATE_STRING (2, domain); + c_domain = scm_to_locale_string (domain); + if (SCM_UNBNDP (category)) + { + /* 2 argument case. */ + result = dgettext (c_domain, c_msgid); + } + else + { + /* 3 argument case. */ + int c_category; + + c_category = scm_validate_category (category, FUNC_NAME, 3); + result = dcgettext (c_domain, c_msgid, c_category); + } + free (c_domain); + } + + if (result == c_msgid) + { + free (c_msgid); + return msgid; + } + else + { + free (c_msgid); + return scm_makfrom0str (result); + } + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_ngettext, "ngettext", 3, 2, 0, + (SCM msgid, SCM msgid_plural, SCM n, SCM domain, SCM category), + "Return the translation of @var{msgid}/@var{msgid_plural} in the " + "message domain @var{domain}, with the plural form being chosen " + "appropriately for the number @var{n}. @var{domain} is optional " + "and defaults to the domain set through (textdomain). " + "@var{category} is optional and defaults to LC_MESSAGES.") + #define FUNC_NAME s_scm_ngettext + { + char *c_msgid; + char *c_msgid_plural; + unsigned long c_n; + const char *result; + + SCM_VALIDATE_STRING (1, msgid); + c_msgid = scm_to_locale_string (msgid); + SCM_VALIDATE_STRING (2, msgid_plural); + c_msgid_plural = scm_to_locale_string (msgid_plural); + SCM_VALIDATE_ULONG_COPY (3, n, c_n); + if (SCM_UNBNDP (domain)) + { + /* 3 argument case. */ + result = ngettext (c_msgid, c_msgid_plural, c_n); + } + else + { + char *c_domain; + + SCM_VALIDATE_STRING (4, domain); + c_domain = scm_to_locale_string (domain); + if (SCM_UNBNDP (category)) + { + /* 4 argument case. */ + result = dngettext (c_domain, c_msgid, c_msgid_plural, c_n); + } + else + { + /* 5 argument case. */ + int c_category; + + c_category = scm_validate_category (category, FUNC_NAME, 5); + result = dcngettext (c_domain, c_msgid, c_msgid_plural, c_n, + c_category); + } + free (c_domain); + } + + if (result == c_msgid) + { + free (c_msgid_plural); + free (c_msgid); + return msgid; + } + else if (result == c_msgid_plural) + { + free (c_msgid_plural); + free (c_msgid); + return msgid_plural; + } + else + { + free (c_msgid_plural); + free (c_msgid); + return scm_makfrom0str (result); + } + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_get_textdomain, "textdomain", 0, 0, 0, + (void), + "Return the current message domain.") + #define FUNC_NAME s_scm_get_textdomain + { + const char *result; + + result = textdomain (NULL); + if (result == NULL) + return SCM_BOOL_F; + else + return scm_makfrom0str (result); + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_set_textdomain, "set!-textdomain", 1, 0, 0, + (SCM domain), + "Change the current message domain.") + #define FUNC_NAME s_scm_set_textdomain + { + char *c_domain; + + SCM_VALIDATE_STRING (1, domain); + c_domain = scm_to_locale_string (domain); + if (textdomain (c_domain) == NULL) + SCM_SYSERROR; + free (c_domain); + return domain; + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_get_textdomain_dir, "textdomaindir", 1, 0, 0, + (SCM domain), + "Return the base directory for message catalogs for the given " + "message domain.") + #define FUNC_NAME s_scm_get_textdomain_dir + { + char *c_domain; + const char *result; + + SCM_VALIDATE_STRING (1, domain); + c_domain = scm_to_locale_string (domain); + result = bindtextdomain (c_domain, NULL); + free (c_domain); + if (result == NULL) + return SCM_BOOL_F; + else + return scm_makfrom0str (result); + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_set_textdomain_dir, "set!-textdomaindir", 2, 0, 0, + (SCM domain, SCM directory), + "Change the base directory for message catalogs for the given " + "message domain.") + #define FUNC_NAME s_scm_set_textdomain_dir + { + char *c_domain; + char *c_directory; + + SCM_VALIDATE_STRING (1, domain); + SCM_VALIDATE_STRING (2, directory); + c_domain = scm_to_locale_string (domain); + c_directory = scm_to_locale_string (directory); + if (bindtextdomain (c_domain, c_directory) == NULL) + SCM_SYSERROR; + free (c_directory); + free (c_domain); + return directory; + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_get_textdomain_codeset, "textdomain-codeset", 1, 0, 0, + (SCM domain), + "Return the encoding for message catalogs for the given message " + "domain.") + #define FUNC_NAME s_scm_get_textdomain_codeset + { + char *c_domain; + const char *result; + + SCM_VALIDATE_STRING (1, domain); + c_domain = scm_to_locale_string (domain); + result = bind_textdomain_codeset (c_domain, NULL); + free (c_domain); + if (result == NULL) + return SCM_BOOL_F; + else + return scm_makfrom0str (result); + } + #undef FUNC_NAME + + + SCM_DEFINE (scm_set_textdomain_codeset, "set!-textdomain-codeset", 2, 0, 0, + (SCM domain, SCM encoding), + "Change the encoding for message catalogs for the given message " + "domain.") + #define FUNC_NAME s_scm_set_textdomain_codeset + { + char *c_domain; + char *c_encoding; + + SCM_VALIDATE_STRING (1, domain); + SCM_VALIDATE_STRING (2, encoding); + c_domain = scm_to_locale_string (domain); + c_encoding = scm_to_locale_string (encoding); + if (bind_textdomain_codeset (c_domain, c_encoding) == NULL) + SCM_SYSERROR; + free (c_encoding); + free (c_domain); + return encoding; + } + #undef FUNC_NAME + + + void + scm_init_i18n () + { + SCM gettersym, settersym; + + scm_add_feature ("i18n"); + #include "libguile/i18n.x" + + gettersym = scm_c_lookup ("textdomain"); + settersym = scm_c_lookup ("set!-textdomain"); + SCM_VARIABLE_SET (gettersym, + scm_make_procedure_with_setter ( + SCM_VARIABLE_REF (gettersym), + SCM_VARIABLE_REF (settersym))); + + gettersym = scm_c_lookup ("textdomaindir"); + settersym = scm_c_lookup ("set!-textdomaindir"); + SCM_VARIABLE_SET (gettersym, + scm_make_procedure_with_setter ( + SCM_VARIABLE_REF (gettersym), + SCM_VARIABLE_REF (settersym))); + + gettersym = scm_c_lookup ("textdomain-codeset"); + settersym = scm_c_lookup ("set!-textdomain-codeset"); + SCM_VARIABLE_SET (gettersym, + scm_make_procedure_with_setter ( + SCM_VARIABLE_REF (gettersym), + SCM_VARIABLE_REF (settersym))); + } + + + /* + Local Variables: + c-file-style: "gnu" + End: + */ *** /dev/null 1970-01-01 01:00:00.000000000 +0100 --- guile-1.7.1/libguile/gettext.h 2002-05-10 13:20:06.000000000 +0200 *************** *** 0 **** --- 1,69 ---- + /* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + + #ifndef _LIBGETTEXT_H + #define _LIBGETTEXT_H 1 + + /* NLS can be disabled through the configure --disable-nls option. */ + #if ENABLE_NLS + + /* Get declarations of GNU message catalog functions. */ + # include + + #else + + /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ + #if defined(__sun) + # include + #endif + + /* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ + # define gettext(Msgid) ((const char *) (Msgid)) + # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) + # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) + # define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + # define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) + # define textdomain(Domainname) ((const char *) (Domainname)) + # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) + # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + + #endif + + /* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ + #define gettext_noop(String) String + + #endif /* _LIBGETTEXT_H */ --Boundary-00=_7pfOBJxYfrKD/sY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --Boundary-00=_7pfOBJxYfrKD/sY--