From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: i18n, gettext support Date: Wed, 22 Sep 2004 02:42:03 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87llf3b0dg.fsf@zagadka.ping.de> References: <200408202226.10769.bruno@clisp.org> <87pt4yp3jn.fsf@peder.flower> <87sm9tftng.fsf@zip.com.au> <200409081239.23769.bruno@clisp.org> <873c1swhpm.fsf@peder.flower> <87k6v45qhl.fsf@zip.com.au> <87n000uxwa.fsf@peder.flower> <877jr3flzh.fsf@peder.flower> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1095814446 2771 80.91.229.6 (22 Sep 2004 00:54:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Sep 2004 00:54:06 +0000 (UTC) Cc: Bruno Haible , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Sep 22 02:53:47 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 1C9vOD-0002yB-00 for ; Wed, 22 Sep 2004 02:53:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C9vU9-0001Fj-08 for guile-devel@m.gmane.org; Tue, 21 Sep 2004 20:59:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C9vTy-0001FL-PI for guile-devel@gnu.org; Tue, 21 Sep 2004 20:59:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C9vTx-0001Ee-3E for guile-devel@gnu.org; Tue, 21 Sep 2004 20:59:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C9vTw-0001EU-Ty for guile-devel@gnu.org; Tue, 21 Sep 2004 20:59:41 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C9vNy-0002te-9E for guile-devel@gnu.org; Tue, 21 Sep 2004 20:53:30 -0400 Original-Received: from [195.253.8.218] (helo=mail.dokom.net) by mx20.gnu.org with esmtp (Exim 4.34) id 1C9vD0-0005K4-VJ for guile-devel@gnu.org; Tue, 21 Sep 2004 20:42:11 -0400 Original-Received: from [195.253.15.201] (helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 4.34) id 1C9vCu-0005iT-C4 for guile-devel@gnu.org; Wed, 22 Sep 2004 02:42:10 +0200 Original-Received: (qmail 15978 invoked by uid 1000); 22 Sep 2004 00:42:03 -0000 Original-To: Jan Nieuwenhuizen In-Reply-To: <877jr3flzh.fsf@peder.flower> (Jan Nieuwenhuizen's message of "Thu, 09 Sep 2004 18:25:22 +0200") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) 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:4139 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4139 --=-=-= Jan Nieuwenhuizen writes: > New and improved. This version not only compiles, but has also been > tested; it should now work even with --disable-nls. Thanks Bruno! I changed it a bit, mostly by using scm_frame_begin and scm_frame_end in i18n.c to manage the temporary strings. Also, there is no need to validate the arguments when using scm_to_local_string. See the patch below. Do you intend scm_to_lc_category to be part of the public API? If so, it will have to be documented, of course. I have made it internal for now. --=-=-= Content-Disposition: inline; filename=diff-i18n Index: ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/ChangeLog,v retrieving revision 1.447 diff -u -r1.447 ChangeLog --- ChangeLog 21 Sep 2004 00:10:02 -0000 1.447 +++ ChangeLog 22 Sep 2004 00:38:51 -0000 @@ -1,3 +1,7 @@ +2004-09-22 Marius Vollmer + + * configure.in: Add AM_GNU_GETTEXT invocation. From Bruno Haible. + 2004-09-21 Marius Vollmer * acinclude.m4 (ACX_PTHREAD): New. Index: configure.in =================================================================== RCS file: /cvsroot/guile/guile/guile-core/configure.in,v retrieving revision 1.254 diff -u -r1.254 configure.in --- configure.in 21 Sep 2004 00:09:47 -0000 1.254 +++ configure.in 22 Sep 2004 00:38:55 -0000 @@ -637,6 +637,9 @@ [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. Index: libguile/ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v retrieving revision 1.2151 diff -u -r1.2151 ChangeLog --- libguile/ChangeLog 21 Sep 2004 22:05:51 -0000 1.2151 +++ libguile/ChangeLog 22 Sep 2004 00:39:26 -0000 @@ -1,5 +1,35 @@ 2004-09-22 Marius Vollmer + From Jan Nieuwenhuizen and Bruno Haible + : + + * i18n.c: Handle --disable-nls (thanks Bruno). + + * posix.c (scm_init_posix): Add LC_PAPER, LC_NAME, LC_ADDRESS, + LC_TELEPHONE, LC_MEASUREMENT, LC_IDENTIFICATION. + + * i18n.c (scm_i_to_lc_category): New name and export. Support all + LC categories. + + * posix.c (s_scm_setlocale): Use it. + + * i18n.h, i18n.c (scm_textdomain, scm_bindtextdomain, + scm_bind_textdomain_codeset): Make wrappers similar to C function + they wrap. + + * 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. + +2004-09-22 Marius Vollmer + * eq.c (scm_equal_p): Allow smobs with different flags to be equal by testing for smobs before insisting on equal SCM_CELL_TYPES. Index: libguile/Makefile.am =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/Makefile.am,v retrieving revision 1.192 diff -u -r1.192 Makefile.am --- libguile/Makefile.am 8 Sep 2004 17:15:21 -0000 1.192 +++ libguile/Makefile.am 22 Sep 2004 00:39:27 -0000 @@ -97,7 +97,7 @@ 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 \ + 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,7 +113,7 @@ 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 \ + 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,8 +132,8 @@ 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 \ + 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,7 +172,7 @@ 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 +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,7 +187,7 @@ 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 \ + 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 \ Index: libguile/gettext.h =================================================================== RCS file: libguile/gettext.h diff -N libguile/gettext.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libguile/gettext.h 22 Sep 2004 00:39:28 -0000 @@ -0,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 */ Index: libguile/i18n.c =================================================================== RCS file: libguile/i18n.c diff -N libguile/i18n.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libguile/i18n.c 22 Sep 2004 00:39:28 -0000 @@ -0,0 +1,327 @@ +/* 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/feature.h" +#include "libguile/i18n.h" +#include "libguile/strings.h" +#include "libguile/dynwind.h" + +#include "gettext.h" +#include + + +int +scm_i_to_lc_category (SCM category, int allow_lc_all) +{ + int c_category = scm_to_int (category); + switch (c_category) + { +#ifdef LC_CTYPE + case LC_CTYPE: +#endif +#ifdef LC_NUMERIC + case LC_NUMERIC: +#endif +#ifdef LC_COLLATE + case LC_COLLATE: +#endif +#ifdef LC_TIME + case LC_TIME: +#endif +#ifdef LC_MONETARY + case LC_MONETARY: +#endif +#ifdef LC_MESSAGES + case LC_MESSAGES: +#endif +#ifdef LC_PAPER + case LC_PAPER: +#endif +#ifdef LC_NAME + case LC_NAME: +#endif +#ifdef LC_ADDRESS + case LC_ADDRESS: +#endif +#ifdef LC_TELEPHONE + case LC_TELEPHONE: +#endif +#ifdef LC_MEASUREMENT + case LC_MEASUREMENT: +#endif +#ifdef LC_IDENTIFICATION + case LC_IDENTIFICATION: +#endif + return c_category; +#ifdef LC_ALL + case LC_ALL: + if (allow_lc_all) + return c_category; +#endif + } + scm_wrong_type_arg (0, 0, 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; + char const *c_result; + SCM result; + + scm_frame_begin (0); + + c_msgid = scm_to_locale_string (msgid); + scm_frame_free (c_msgid); + + if (SCM_UNBNDP (domain)) + { + /* 1 argument case. */ + c_result = gettext (c_msgid); + } + else + { + char *c_domain; + + c_domain = scm_to_locale_string (domain); + scm_frame_free (c_domain); + + if (SCM_UNBNDP (category)) + { + /* 2 argument case. */ + c_result = dgettext (c_domain, c_msgid); + } + else + { + /* 3 argument case. */ + int c_category; + + c_category = scm_i_to_lc_category (category, 0); + c_result = dcgettext (c_domain, c_msgid, c_category); + } + } + + if (c_result == c_msgid) + result = msgid; + else + result = scm_from_locale_string (c_result); + + scm_frame_end (); + return 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 *c_result; + SCM result; + + scm_frame_begin (0); + + c_msgid = scm_to_locale_string (msgid); + scm_frame_free (c_msgid); + + c_msgid_plural = scm_to_locale_string (msgid_plural); + scm_frame_free (c_msgid_plural); + + c_n = scm_to_ulong (n); + + if (SCM_UNBNDP (domain)) + { + /* 3 argument case. */ + c_result = ngettext (c_msgid, c_msgid_plural, c_n); + } + else + { + char *c_domain; + + c_domain = scm_to_locale_string (domain); + scm_frame_free (c_domain); + + if (SCM_UNBNDP (category)) + { + /* 4 argument case. */ + c_result = dngettext (c_domain, c_msgid, c_msgid_plural, c_n); + } + else + { + /* 5 argument case. */ + int c_category; + + c_category = scm_i_to_lc_category (category, 0); + c_result = dcngettext (c_domain, c_msgid, c_msgid_plural, c_n, + c_category); + } + } + + if (c_result == c_msgid) + result = msgid; + else if (c_result == c_msgid_plural) + result = msgid_plural; + else + result = scm_from_locale_string (c_result); + + scm_frame_end (); + return result; +} +#undef FUNC_NAME + +SCM_DEFINE (scm_textdomain, "textdomain", 0, 1, 0, + (SCM domainname), + "If optional parameter @var{domainname} is supplied, " + "set the textdomain. " + "Return the textdomain.") +#define FUNC_NAME s_scm_textdomain +{ + char const *c_result; + char *c_domain; + SCM result = SCM_BOOL_F; + + scm_frame_begin (0); + + if (SCM_UNBNDP (domainname)) + c_domain = NULL; + else + { + c_domain = scm_to_locale_string (domainname); + scm_frame_free (c_domain); + } + + c_result = textdomain (c_domain); + if (c_result != NULL) + result = scm_from_locale_string (c_result); + else if (!SCM_UNBNDP (domainname)) + SCM_SYSERROR; + + scm_frame_end (); + return result; +} +#undef FUNC_NAME + +SCM_DEFINE (scm_bindtextdomain, "bindtextdomain", 1, 1, 0, + (SCM domainname, SCM directory), + "If optional parameter @var{directory} is supplied, " + "set message catalogs to directory @{directory}. " + "Return the directory bound to @var{domainname}.") +#define FUNC_NAME s_scm_bindtextdomain +{ + char *c_domain; + char *c_directory; + char const *c_result; + SCM result; + + scm_frame_begin (0); + + if (SCM_UNBNDP (directory)) + c_directory = NULL; + else + { + c_directory = scm_to_locale_string (directory); + scm_frame_free (c_directory); + } + + c_domain = scm_to_locale_string (domainname); + scm_frame_free (c_domain); + + c_result = bindtextdomain (c_domain, c_directory); + + if (c_result != NULL) + result = scm_from_locale_string (c_result); + else if (!SCM_UNBNDP (directory)) + SCM_SYSERROR; + else + result = SCM_BOOL_F; + + scm_frame_end (); + return result; +} +#undef FUNC_NAME + +SCM_DEFINE (scm_bind_textdomain_codeset, "bind-textdomain-codeset", 1, 1, 0, + (SCM domainname, SCM encoding), + "If optional parameter @var{encoding} is supplied, " + "set encoding for message catalogs of @{domainname}. " + "Return the encoding of @var{domainname}.") +#define FUNC_NAME s_scm_bind_textdomain_codeset +{ + char *c_domain; + char *c_encoding; + char const *c_result; + SCM result; + + scm_frame_begin (0); + + if (SCM_UNBNDP (encoding)) + c_encoding = NULL; + else + { + c_encoding = scm_to_locale_string (encoding); + scm_frame_free (c_encoding); + } + + c_domain = scm_to_locale_string (domainname); + scm_frame_free (c_domain); + + c_result = bind_textdomain_codeset (c_domain, c_encoding); + + if (c_result != NULL) + result = scm_from_locale_string (c_result); + else if (!SCM_UNBNDP (encoding)) + SCM_SYSERROR; + else + result = SCM_BOOL_F; + + scm_frame_end (); + return result; +} +#undef FUNC_NAME + +void +scm_init_i18n () +{ + scm_add_feature ("i18n"); +#include "libguile/i18n.x" +} + + +/* + Local Variables: + c-file-style: "gnu" + End: +*/ Index: libguile/i18n.h =================================================================== RCS file: libguile/i18n.h diff -N libguile/i18n.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ libguile/i18n.h 22 Sep 2004 00:39:28 -0000 @@ -0,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_textdomain (SCM domainname); +SCM_API SCM scm_bindtextdomain (SCM domainname, SCM directory); +SCM_API SCM scm_bind_textdomain_codeset (SCM domainname, SCM encoding); + +SCM_API int scm_i_to_lc_category (SCM category, int allow_lc_all); + +SCM_API void scm_init_i18n (void); + +#endif /* SCM_I18N_H */ + +/* + Local Variables: + c-file-style: "gnu" + End: +*/ Index: libguile/init.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/init.c,v retrieving revision 1.159 diff -u -r1.159 init.c --- libguile/init.c 24 Aug 2004 22:13:07 -0000 1.159 +++ libguile/init.c 22 Sep 2004 00:39:29 -0000 @@ -63,6 +63,7 @@ #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,6 +478,7 @@ 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 (); Index: libguile/posix.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/posix.c,v retrieving revision 1.147 diff -u -r1.147 posix.c --- libguile/posix.c 7 Sep 2004 00:26:48 -0000 1.147 +++ libguile/posix.c 22 Sep 2004 00:39:34 -0000 @@ -39,6 +39,7 @@ #include "libguile/validate.h" #include "libguile/posix.h" +#include "libguile/i18n.h" #ifdef HAVE_STRING_H @@ -1365,7 +1366,7 @@ scm_frame_free (clocale); } - rv = setlocale (scm_to_int (category), clocale); + rv = setlocale (scm_i_to_lc_category (category, 1), clocale); if (rv == NULL) SCM_SYSERROR; @@ -1929,6 +1930,24 @@ #ifdef LC_ALL scm_c_define ("LC_ALL", scm_from_int (LC_ALL)); #endif +#ifdef LC_PAPER + scm_c_define ("LC_PAPER", scm_from_int (LC_PAPER)); +#endif +#ifdef LC_NAME + scm_c_define ("LC_NAME", scm_from_int (LC_NAME)); +#endif +#ifdef LC_ADDRESS + scm_c_define ("LC_ADDRESS", scm_from_int (LC_ADDRESS)); +#endif +#ifdef LC_TELEPHONE + scm_c_define ("LC_TELEPHONE", scm_from_int (LC_TELEPHONE)); +#endif +#ifdef LC_MEASUREMENT + scm_c_define ("LC_MEASUREMENT", scm_from_int (LC_MEASUREMENT)); +#endif +#ifdef LC_IDENTIFICATION + scm_c_define ("LC_IDENTIFICATION", scm_from_int (LC_IDENTIFICATION)); +#endif #ifdef PIPE_BUF scm_c_define ("PIPE_BUF", scm_from_long (PIPE_BUF)); #endif --=-=-= -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 --=-=-= 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 --=-=-=--