Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Handling of LANG (and other LC_*) in zsh.



Hi!

I already mentioned this problem; now I try to provide patch for it ;-)

Environment: zsh-3.0-pre2
Problem: if LANG is changed, zsh tries to change its locale by using
setlocale(LC_ALL, <value of LANG>). Alas! it breaks normal handling of
locale: if any of LC_* is set, it overrides LANG setting.

I tried to solve it in some portable (IMHO;) way: when any of LANG or LC_*
variables is changed, it is put in zsh environment and
setlocale(LC_ALL,"") is called; it should have the same effect as setting
variable in environment *before* starting zsh.

I put all LC_* there; it doesn't hurt even if on some systems they are not
used, does it?

I am not member of this list; so I would appreciate any Cc of you comments
on my suggestion. 

Diffs attached

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@xxxxxx
-------------------------------------------------------------------------

======================= diffs ============================
--- Src/hashtable.h.org	Mon Jul  8 17:37:55 1996
+++ Src/hashtable.h	Mon Jul  8 17:37:25 1996
@@ -106,6 +106,13 @@
 IPDEF2("_", underscoregetfn, IFN(nullsetfn), PM_READONLY),
 #ifdef LC_ALL
 IPDEF2("LANG", strgetfn, langsetfn, 0),
+IPDEF2("LC_CTYPE", strgetfn, langsetfn, 0),
+IPDEF2("LC_NUMERIC", strgetfn, langsetfn, 0),
+IPDEF2("LC_TIME", strgetfn, langsetfn, 0),
+IPDEF2("LC_COLLATE", strgetfn, langsetfn, 0),
+IPDEF2("LC_MONETARY", strgetfn, langsetfn, 0),
+IPDEF2("LC_MESSAGES", strgetfn, langsetfn, 0),
+IPDEF2("LC_ALL", strgetfn, langsetfn, 0),
 #endif
 
 #define IPDEF4(A,B) {NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL,NULL,IFN(nullsetfn),IFN(intvargetfn),10,(void *)B,NULL,NULL,NULL,0}
--- Src/params.c.org	Mon Jul  8 17:38:03 1996
+++ Src/params.c	Mon Jul  8 17:40:32 1996
@@ -1567,7 +1567,8 @@
 void
 langsetfn(Param pm, char *x)
 {
-   setlocale(LC_ALL, x);
+   addenv(pm->nam, x);
+   setlocale(LC_ALL, "");
    strsetfn(pm, x);
 }
 #endif




Messages sorted by: Reverse Date, Date, Thread, Author