I made a resource script with two languages, so I get automatically german texts on a german windows and english on an english one:


IDS_HELP "Hilfe"
now I have two questions: if I use LoadString Windows decides, which language to load. Can I change this decicion to another language? Something like SetGlobalLanguage (ID) would be fine :) ... other question: some strings are identical in both languages, can I make a third section with LANGUAGE_NEUTRAL, that contains the equal strings for all languages?
Posted on 2003-11-27 05:23:30 by beaster
Afternoon, beaster.

Is this what you're looking for? ...

Platform SDK: International Features
The SetThreadLocale function sets the calling thread's current locale.

BOOL SetThreadLocale (
LCID Locale // locale identifier
Specifies the new locale for the calling thread. This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values. Value Meaning
LOCALE_SYSTEM_DEFAULT Default system locale.
LOCALE_USER_DEFAULT Default user locale.

For more information, see Locales.

Return Values
If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

When a thread is created, it uses the system default thread locale. The system reads the system default thread locale from the registry when the system boots. This system default can be modified for future process and thread creation using Control Panel's International application.

The SetThreadLocale function affects the selection of resources that are defined with a LANGUAGE statement. This affects such functions as CreateDialog, DialogBox, LoadMenu, LoadString, and FindResource, and sets the code page implied by CP_THREAD_ACP, but does not affect FindResourceEx.

Windows NT/2000 or later: Requires Windows NT 3.1 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Winnls.h; include Windows.h.
Library: Use Kernel32.lib.

See Also
National Language Support Overview, National Language Support Functions, CreateDialog, DialogBox, LoadMenu, LoadString, FindResource, GetThreadLocale, GetSystemDefaultLCID, GetUserDefaultLCID, MAKELCID

Microsoft Platform SDK, February 2001 Edition.
This content last built on Thursday, February 01, 2001.

Posted on 2003-11-27 06:57:04 by Scronty
I know you can change the langid with FormatMessage but with LoadString I don't know
Posted on 2003-11-27 12:41:51 by greenant
ah thanks, SetThreadLocale seems to be what I was looking for, unfortunately its not for Win9X. Maybe I will write a helper function with FindResource and LoadResource, that can do something like LoadLocalString (hIntance, idString, idLang, pszText)
Posted on 2003-11-28 06:35:02 by beaster
...or you could code your own string localization stuff :)
Posted on 2003-11-28 06:44:53 by f0dder