Make wine honor LC_CTYPE and LC_MESSAGES

Shachar Shemesh wine-devel at shemesh.biz
Wed Jul 14 01:45:49 CDT 2004


Hi Alexandre,

I was wondering whether there was a reason this patch was not applied.

             Shachar

Shachar Shemesh wrote:

> Changelog:
> Shachar Shemesh <winecode at shemesh.biz>
> dlls/kernel/locale.c
>
>    * System default locale in Windows determines the ANSI encoding
>      (LC_CTYPE on Unix)
>    * User default locale determines the language in which the system
>      works (LC_MESSAGES on Unix).
>
>
>------------------------------------------------------------------------
>
>Index: dlls/kernel/locale.c
>===================================================================
>RCS file: /home/sun/sources/cvs/wine/dlls/kernel/locale.c,v
>retrieving revision 1.46
>diff -u -r1.46 locale.c
>--- dlls/kernel/locale.c	7 Jul 2004 00:47:31 -0000	1.46
>+++ dlls/kernel/locale.c	8 Jul 2004 18:01:22 -0000
>@@ -505,13 +505,14 @@
> /***********************************************************************
>  *		init_default_lcid
>  */
>-static LCID init_default_lcid( UINT *unix_cp )
>+static LCID init_default_lcid( UINT *unix_cp, const char *env1, const char *env2 )
> {
>     char *buf, *lang,*country,*charset,*dialect,*next;
>     LCID ret = 0;
> 
>     if ((lang = getenv( "LC_ALL" )) ||
>-        (lang = getenv( "LANGUAGE" )) ||
>+        (lang = getenv( env1 )) ||
>+        (env2 && (lang = getenv( env2 ))) ||
>         (lang = getenv( "LANG" )))
>     {
>         if (!strcmp(lang,"POSIX") || !strcmp(lang,"C")) goto done;
>@@ -2483,11 +2484,13 @@
>                                        const union cptable *unix_cp );
> 
>     UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp = ~0U;
>-    LCID lcid = init_default_lcid( &unix_cp );
>+    LCID lcid = init_default_lcid( &unix_cp, "LC_MESSAGES", "LANGUAGE" );
> 
>-    NtSetDefaultLocale( FALSE, lcid );
>     NtSetDefaultLocale( TRUE, lcid );
> 
>+    lcid = init_default_lcid( &unix_cp, "LC_CTYPE", NULL );
>+    NtSetDefaultLocale( FALSE, lcid );
>+
>     ansi_cp = get_lcid_codepage(lcid);
>     GetLocaleInfoW( lcid, LOCALE_IDEFAULTMACCODEPAGE | LOCALE_RETURN_NUMBER,
>                     (LPWSTR)&mac_cp, sizeof(mac_cp)/sizeof(WCHAR) );
>  
>


-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/




More information about the wine-devel mailing list