From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#24186: setlocale can't be localised Date: Tue, 11 Oct 2016 10:06:15 +0200 Message-ID: <87h98j1f9k.fsf@gnu.org> References: <20160808163214.GF24721@fysh.org> <87invbm25x.fsf@pobox.com> <20160808223037.GI24721@fysh.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1476173252 7034 195.159.176.226 (11 Oct 2016 08:07:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Oct 2016 08:07:32 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 24186@debbugs.gnu.org To: Zefram Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Oct 11 10:07:27 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bts5n-0000Hf-Pf for guile-bugs@m.gmane.org; Tue, 11 Oct 2016 10:07:19 +0200 Original-Received: from localhost ([::1]:54281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bts5k-0005zG-W2 for guile-bugs@m.gmane.org; Tue, 11 Oct 2016 04:07:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bts5c-0005z5-1K for bug-guile@gnu.org; Tue, 11 Oct 2016 04:07:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bts5W-0004NE-Fl for bug-guile@gnu.org; Tue, 11 Oct 2016 04:07:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bts5W-0004N7-Bj for bug-guile@gnu.org; Tue, 11 Oct 2016 04:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bts5W-0004Cy-6g for bug-guile@gnu.org; Tue, 11 Oct 2016 04:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 11 Oct 2016 08:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24186 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 24186-submit@debbugs.gnu.org id=B24186.147617319716146 (code B ref 24186); Tue, 11 Oct 2016 08:07:02 +0000 Original-Received: (at 24186) by debbugs.gnu.org; 11 Oct 2016 08:06:37 +0000 Original-Received: from localhost ([127.0.0.1]:51682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bts53-0004CJ-MK for submit@debbugs.gnu.org; Tue, 11 Oct 2016 04:06:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bts4y-0004C1-S2 for 24186@debbugs.gnu.org; Tue, 11 Oct 2016 04:06:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bts4p-00044z-3p for 24186@debbugs.gnu.org; Tue, 11 Oct 2016 04:06:23 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bts4p-000445-1O; Tue, 11 Oct 2016 04:06:19 -0400 Original-Received: from pluto.bordeaux.inria.fr ([193.50.110.57]:59570 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1bts4n-0001pv-Bw; Tue, 11 Oct 2016 04:06:17 -0400 In-Reply-To: <20160808223037.GI24721@fysh.org> (zefram@fysh.org's message of "Mon, 8 Aug 2016 23:30:37 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8423 Archived-At: Hi, Zefram skribis: > (define (call-with-locale cat val body) > (let ((oldval #f)) > (dynamic-wind > (lambda () (set! oldval (setlocale cat)) (setlocale cat val)) > body (lambda () (setlocale cat oldval))))) > > (define (day-of-week-string) > (strftime "%A" (localtime (current-time))))=20 > > (define (day-of-week-string-for-locale loc) > (call-with-locale LC_TIME loc day-of-week-string)) > > ;; user-locale is application-specific code defined elsewhere > (define (day-of-week-string-for-user user) > (day-of-week-string-for-locale (user-locale user))) This does not really answer your question, but (ice-9 i18n) provides first-class locale objects, which avoid the whole global locale issue (info "(guile) Internationalization"). Currently important procedures such as =E2=80=98strftime=E2=80=99 or SRFI-1= 9=E2=80=99s =E2=80=98date->string=E2=80=99 cannot use such locale objects, though. I t= hink it would make sense to add an optional locale object argument to =E2=80=98srftime=E2= =80=99 and =E2=80=98date->string=E2=80=99 (though we should create a (srfi srfi-19 gnu= ) module for that to make it clear that this is a GNU extension.) That wouldn=E2=80=99t help with the =E2=80=98setlocale=E2=80=99 issue you d= escribe per se, but this would address such use cases in a different way. WDYT? Ludo=E2=80=99.