LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT and
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
but whatever language setting I do in Windows, I always get the
German texts.
I replaced LANG_NEUTRAL, SUBLANG_DEFAULT by LANG_NEUTRAL,
SUBLANG_NEUTRAL, but this gives me the default texts always, even
if my Windows setting is German.
As far as I know, LoadString tries to find an exact match first
(like GERMAN,GERMAN). If it fails it looks for the country
independent stringtable (GERMAN,NEUTRAL). And if that fails, it
looks for a default table (NEUTRAL,DEFAULT? or should that be
NEUTRAL,NEUTRAL? Both makes sense, neither works).
Where is my problem? Damaged Windows? Damaged brain?
> LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT and
> LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
>
>but whatever language setting I do in Windows, I always get the
>German texts.
Did you try LANGUAGE LANG_NEUTRAL,SUBLANG_SYS_DEFAULT?
>I replaced LANG_NEUTRAL, SUBLANG_DEFAULT by LANG_NEUTRAL,
>SUBLANG_NEUTRAL, but this gives me the default texts always, even
>if my Windows setting is German.
Are they position dependant...as in the first match is what it uses?
If so, then German should be before Neutral.
>As far as I know, LoadString tries to find an exact match first
>(like GERMAN,GERMAN). If it fails it looks for the country
>independent stringtable (GERMAN,NEUTRAL). And if that fails, it
>looks for a default table (NEUTRAL,DEFAULT? or should that be
>NEUTRAL,NEUTRAL? Both makes sense, neither works).
My reading of LoadString is that it loads the resource. Period.
It looks like it is up to you to supply the correct resource ID .
I think the original intent was for you to have seperate RC files for
each language, and to link them individually for each destination.
I suppose you could have something like this...
#define string1 0x4000
#define string2 0x4001
STRINGTABLE
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
BEGIN
string1 "This is German string 1"
string2 "This is German string 2"
END
STRINGTABLE
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
BEGIN
string1+0x1000 "This is neutral string 1"
string2+0x1000 "This is neutral string 2"
END
LoadString( hInst, string1+(IsThisGerman()?0:0x1000), buffer,
sizeof(buffer)-1 );
>
>Hi all,
>I am trying to build an rc file containing a German stringtable
>and a default string table for all other language settings. The
>problem is it doesn't work.
You can make a DLL for each language and load your resources from the
appropriate DLL at runtime. The defaults can be built into your EXE
and the German can be in a DLL.
FindResourceEx can be used to find a resource with a specified
language and then you can use LoadResource to access the raw resource
data. The documentation for SetThreadLocale claims that the setting
affects the loading of resources from LoadString and other type
specific resource functions.
Chris Hill
Chri...@aol.com
Thank you for your answers Bob and Chris. I know I can build
separate resource dlls and of course I can use different ids
for different languages, but I think the way I describe should
also work and it would be extremely easy to code. I have tested
an rc file with four tables:
#define IDS_TEST 1000
STRINGTABLE DISCARDABLE
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
BEGIN
IDS_TEST "LANG_GERMAN, SUBLANG_NEUTRAL"
END
STRINGTABLE DISCARDABLE
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
BEGIN
IDS_TEST "LANG_GERMAN, SUBLANG_GERMAN"
END
STRINGTABLE DISCARDABLE
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
BEGIN
IDS_TEST "LANG_NEUTRAL, SUBLANG_DEFAULT"
END
STRINGTABLE DISCARDABLE
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
BEGIN
IDS_TEST "LANG_ENGLISH, SUBLANG_NEUTRAL"
END
Here is what LoadStr/LoadString give me for a specific Windows
setting:
Windows setting: LoadString result:
German/Germany LANG_GERMAN, SUBLANG_GERMAN
German/Austria LANG_GERMAN, SUBLANG_NEUTRAL
English/UK LANG_ENGLISH, SUBLANG_NEUTRAL
English/USA LANG_ENGLISH, SUBLANG_NEUTRAL
French/France LANG_GERMAN, SUBLANG_GERMAN
You see everything works fine, except for the unknown language
(French in this case). Seeing that it defaults to German/Germany
I thought this is because my computer is German. So I deleted
the rc entries LANG_GERMAN, SUBLANG_GERMAN and LANG_GERMAN,
SUBLANG_NEUTRAL. But then I got LANG_ENGLISH, SUBLANG_NEUTRAL
for French! This shows LANG_NEUTRAL, SUBLANG_DEFAULT is just
not the correct entry for a default, but has some other meaning.
But there must be a default setting! It cannot be that French
people get a random language!
Does anybody else know how to declare the default stringtable?
>Windows setting: LoadString result:
>German/Germany LANG_GERMAN, SUBLANG_GERMAN
>German/Austria LANG_GERMAN, SUBLANG_NEUTRAL
>English/UK LANG_ENGLISH, SUBLANG_NEUTRAL
>English/USA LANG_ENGLISH, SUBLANG_NEUTRAL
>French/France LANG_GERMAN, SUBLANG_GERMAN
>
>You see everything works fine, except for the unknown language
>(French in this case). Seeing that it defaults to German/Germany
>I thought this is because my computer is German. So I deleted
>the rc entries LANG_GERMAN, SUBLANG_GERMAN and LANG_GERMAN,
>SUBLANG_NEUTRAL. But then I got LANG_ENGLISH, SUBLANG_NEUTRAL
>for French! This shows LANG_NEUTRAL, SUBLANG_DEFAULT is just
>not the correct entry for a default, but has some other meaning.
>But there must be a default setting! It cannot be that French
>people get a random language!
Nifty! Did not know that.
Maybe _anything_ (or at least German or English) is preferable to
Neutral.
Test (#1) if there were only 2 choices, Neutral or Chinese?
If French picks Chinese over Neutral, then??
I would think German and English would act the same as French in this
test.
Test (#2) if Neutral had SUBLANG_SYS_DEFAULT?
No, probably not, as that is German in your case and you're looking
for French. But, if you had a French system, then it might match.
Hmmm...If Test#1 fails, then try it with this way against German to
see if it picks Chinese or SYS.
If test #2 works, then your app will pick the matching supplied
language, or the Neutral if/onlyif user==system language.
Otherwise, it looks like it picks the first non-neutral language.
So, for example, you could setup Chinese as your first (default)
language. (Well, maybe not Chinese, as that's likely wide char only.)