LANGUAGE Statement in RC Differs in Windows NT from Windows 95

ID: Q140763


The information in this article applies to:


SUMMARY

The LANGUAGE statement in resource files sets the language for all resources up to the next LANGUAGE statement or to the end of the file. When the LANGUAGE statement appears before the BEGIN in an ACCELERATORS, DIALOG, MENU, RCDATA, or STRINGTABLE resource definition, the specified language applies only to that resource.

The general syntax for the language statement is:

LANGUAGE language, sublanguage


MORE INFORMATION

In Windows NT, several language versions of the same resource (with the same ID and type) can be loaded at the same time. The programmer can decide which language version of the resource to use dynamicaly by calling SetThreadLocale(). For example, the following is in a RC file:


ABOUTBOX DIALOG DISCARDABLE  52, 57, 144, 45
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
STYLE DS_MODALFRAME | WS_CAPTION
FONT 8, "System"
BEGIN
    CTEXT           "Microsoft(r)",-1,0,5,144,8
    CTEXT           "German menu Example",-1,0,14,144,8
    ICON            IDR_MENU,-1,10,10,18,20
    DEFPUSHBUTTON   "OK",IDOK,53,25,32,14,WS_GROUP
END

ABOUTBOX DIALOG DISCARDABLE  52, 57, 144, 45
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STYLE DS_MODALFRAME | WS_CAPTION
FONT 8, "System"
BEGIN
    CTEXT           "Microsoft(r)",-1,0,5,144,8
    CTEXT           "Menu Example",-1,0,14,144,8
    ICON            IDR_MENU,-1,10,10,18,20
    DEFPUSHBUTTON   "OK",IDOK,53,25,32,14,WS_GROUP
END 


In Winodws NT, you can call SetThreadLocale
(MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT)) to set the thread locale to German, and the German resource (the first dialog box) would is automatically used.

In Windows 95, multiple copies of a resource with exactly the same ID and resource type cannot be loaded at the same time. Thus, the only value of LANGUAGE that works is the one that matches the current locale. In the previous example, if the current system locale is German, then only the German dialog box will be loaded.

Additional query words: 4.00 1.30 setlocale kbinf


Keywords          : kbIntlDev 
Version           : 
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: March 5, 1999