LANGUAGE Statement in RC Differs in Windows NT from Windows 95

Last reviewed: January 15, 1998
Article ID: Q140763
1.30 4.00 | 3.51
WINDOWS   | WINDOWS NT
kbprg

The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT version 3.51
        - Microsoft Windows 95 version 4.0
        - Microsoft Win32s version 1.3
    
  • Microsoft Win32 Software Development Kit (SDK) for:

        - Microsoft Windows NT version 3.51
        - Microsoft Windows 95 version 4.0
    

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 reference words: 4.00 1.30 setlocale kbinf
KBCategory: kbprg
KBSubcategory: KBIntlDev
Keywords : KBIntlDev kbprg
Version : 1.30 4.00 | 3.51
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.