Locales with the same language

Vincent Béron vberon at mecano.gme.usherb.ca
Fri Jul 18 14:17:32 CDT 2003


Le ven 18/07/2003 à 09:32, Shachar Shemesh a écrit :
> Dmitry Timoshkov wrote:
> 
> >"Vincent Béron" <vberon at mecano.gme.usherb.ca> wrote:
> >
> >  
> >
> >>(after a bit more testing)
> >>Using only SUBLANG_FRENCH_CANADIAN will display in French on both
> >>Windows and Wine.
> >>Using only SUBLANG_FRENCH_SWISS will display in English on both Windows
> >>and Wine.
> >>Using only SUBLANG_FRENCH will display in French only in Windows,
> >>English in Wine (with LANG=fr_CA).
> >>
> >>So SUBLANG_FRENCH seems to act (on Windows) the same way as a wildcard,
> >>matching any of it's sublanguages if an exact match can't be done.
> >>    
> >>
> >
> >Could you please elaborate a bit, how exactly you did the tests above?

Compiling Wine's notepad in VC6 with different resource files: one for
English, and a couple for LANG_FRENCH/SUBLANG_NEUTRAL, SUBLANG_FRENCH,
SUBLANG_FRENCH_CANADIAN and SUBLANG_FRENCH_SWISS. Actually, that was for
the second batch of results (below).
The ones above come from changing the LANG_FRENCH/SUBLANG_DEFAULT of
pristine notepad to SUBLANG_FRENCH_CANADIAN and SUBLANG_FRENCH_SWISS.

> >
> >  
> >
> >>I also tried defining more than one (ie, SUBLANG_FRENCH and
> >>SUBLANG_FRENCH_CANADIAN) resources. On Windows it chose the
> >>SUBLANG_FRENCH, while in Wine it chose the SUBLANG_FRENCH_CANADIAN. That
> >>gets me a bit puzzled though... unless my installation of Windows is set
> >>to French, then French Canadian as a fallback (don't know of to check
> >>this).
> >>    
> >>
> >
> >All of this highly depend on the exact language set in your system (be it
> >Windows or Wine).
> >
> >I've attached my test app. See the results I got eclosed there between
> >#if 0/#endif.
> >
> >Note, that if your system doesn't support SetThreadLocale() (i.e. you are
> >running Win9x), the system will prefer your current locale settings
> >instead of the provided value and it will influence behaviour of LoadString
> >and FindResource.

W2k here, so this is valid only for it.
LANGIDFROMLCID(GetLocaleThread()) returns 0x0c0c
(FRENCH/FRENCH_CANADIAN) if I don't modify it via SetThreadLocale(), so
I guess that's the default value for that system (equivalent to
LC_ALL=fr_CA).

The results I got (for LoadString and FindResource) are different from
yours though (still W2k). Here's for test.exe 0x0c0c:
1. LANG_NEUTRAL/SUBLANG_NEUTRAL
2. LANG_FRENCH/SUBLANG_FRENCH (==SUBLANG_DEFAULT)
3. LANG_FRENCH/SUBLANG_NEUTRAL
4. LANG_FRENCH/SUBLANG_FRENCH_CANADIAN
5. LANG_ENGLISH/SUBLANG_DEFAULT
6. LANG_ARABIC/SUBLANG_NEUTRAL

So our #2, #3 and #5 are different. Are they dependant on the system
default language? I believe it's more logical to look for the same
language as the current locale before a harcoded English, else as soon
as there's an English resource (DEFAULT or NEUTRAL) nothing else will be
displayed.

Here are the results for test.exe 0x0419 (RUSSIAN/DEFAULT) on the same
system:
1. NEUTRAL/NEUTRAL
2. RUSSIAN/DEFAULT
3. FRENCH/DEFAULT
4. FRENCH/NEUTRAL
5. FRENCH/FRENCH_CANADIAN
6. ENGLISH/DEFAULT
7. ARABIC/NEUTRAL

So we see it goes for current language id/default before system
default/default, and current language id/neutral is not looked for at
all.

Dmitry, on which language have you tested your program under Windows?

> >
> >As you might see, Wine doesn't behave exactly like Windows, Wine makes
> >a preference for the current locale, Windows prefers to choose LANG_ENGLISH
> >first. As it was discussed previously, Wine's behaviour have to stay as
> >it is now, otherwise all NLS support for built-in DLLs and apps will broke.
> >  
> >
> I suspect that this depends on the language of Windows you install. When 
> I have some time, I'll play a bit with this. MS also has a version of 
> windows called "MUI", or Multilinugual User Interface. I suspect that 
> that version behaves more like Wine does at the moment, but I have not 
> checked that one either.
> 
> In the mean while, let's indeed reverese the patch translating 
> SUBLANG_NEUTRAL->SUBLANG_DEFAULT.

Wine's notepad uses LoadString, so it'll look for SUBLANG_DEFAULT before
SUBLANG_NEUTRAL. Hence I support the reversing of the patch.

Vincent




More information about the wine-devel mailing list