kernel: fix determination of using locale

Sergei Butakov butsergej at
Mon Apr 17 14:20:13 CDT 2006

On Monday 17 April 2006 10:04, Dmitry Timoshkov wrote:

> I mean LANG="ru_RU.CP1251", LC_MESSAGES="en_US". Your intent is to avoid
> russian menus and messages, right?

Not fully.
The equivalent of
	# export LANG="POSIX"
	# export LC_CTYPE="ru_RU.CP1251"
	# export LC_COLLATE="ru_RU.CP1251"
	# export LANG="ru_RU.CP1251"
	# export LC_CTYPE="ru_RU.CP1251"
	# export LC_COLLATE="ru_RU.CP1251"
	# export LC_NUMERIC="POSIX"
	# export LC_TIME="POSIX"
	# export LC_PAPER="POSIX"
	# export LC_NAME="POSIX"
	# export LC_ADDRESS="POSIX"
- i.e. LANG and all LC_* must be defined (except LC_ALL).

Both variants are right. All *NIX's programs MUST work equally with both 
variants. And they do it except Wine. 
Wine works with the second variant.
Wine doesn't works as expected with the first variant but it MUST! For *NIX's 
programs the value of LANG doesn't matter in the second variant. But for Wine 
is important. For Wine the meaning of LANG is same LC_CTYPE (see below).

One must correct bug in Wine but not use workaround (the second variant of 
locale) for bypass this bug! Programs must obey to system configs but not 

> > Is there reason don't check LC_CTYPE for defining user_lcid? IMHO no.
> There is already a test for LC_CTYPE a couple of lines below your changes.

From dlls/kernel/locale.c:
void LOCALE_Init(void)
1.    lcid = get_env_lcid( NULL, NULL );
2.    NtSetDefaultLocale( TRUE, lcid );
3.    lcid = get_env_lcid( &unix_cp, "LC_CTYPE" );
4.    NtSetDefaultLocale( FALSE, lcid );

2. - this set value of user_lcid
4. - this set value of system_lcid
system_lcid affect on some part of Wine, user_lcid affect on other one. 
Thereby only some part of Wine is defined by LC_CTYPE:

If set
	# export LANG="POSIX"
	# export LC_CTYPE="ru_RU.CP1251"
system_lcid (defined by LC_CTYPE) will be "ru_RU.CP1251";
user_lcid (defined by LANG) will be "en_US" - It's bug and it's visible in 
programs for Windows.

If set
	# export LANG="ru_RU.CP1251"
	# export LC_CTYPE="ru_RU.CP1251"
system_lcid (defined by LC_CTYPE) will be "ru_RU.CP1251";
user_lcid (defined by LANG) will be "ru_RU.CP1251" - bug still here but it 
isn't visible in programs for Windows.

With my patch "user_lcid" is defined by LC_CTYPE as is done for "system_lcid".

More information about the wine-devel mailing list