Format for LANGUAGE Statement in .RES Files (89822)



The information in this article applies to:

  • Microsoft Win32 Software Development Kit (SDK) 3.1
  • Microsoft Win32 Software Development Kit (SDK) 3.5
  • Microsoft Win32 Software Development Kit (SDK) 3.51
  • Microsoft Win32 Software Development Kit (SDK) 4.0

This article was previously published under Q89822

SUMMARY

The syntax for the LANGUAGE statement in the resource script file is given as follows on page 289 of the Win32 SDK "Tools User's Guide" manual:

LANGUAGE major, minor

major

Language identifier. Must be one of the constants from WINNLS.H

minor

Sublanguage identifier. Must be one of the constants from WINNLS.H

For example, suppose that you want to set the language for the resources in a file to French. For the major parameter, you would choose the following constant from the list of language identifiers
   #define LANG_FRENCH                  0x0c
				
and you would have the choice of any of the sublanguages that begin with SUBLANG_FRENCH in the list of sublanguage identifiers. They are:
   #define SUBLANG_FRENCH               0x01
   #define SUBLANG_FRENCH_BELGIAN       0x02
   #define SUBLANG_FRENCH_CANADIAN      0x03
   #define SUBLANG_FRENCH_SWISS         0x04
				
RC.EXE does not directly place these constants in the .RES file. It uses the macro MAKELANGID to turn the parameters into a WORD that corresponds to a language ID.

NOTE: The following three combinations have special meaning:
Primary language ID   Sublanguage ID       Meaning
---------------------------------------------------------------------
LANG_NEUTRAL          SUBLANG_NEUTRAL      Language neutral
LANG_NEUTRAL          SUBLANG_DEFAULT      User default language
LANG_NEUTRAL          SUBLANG_SYS_DEFAULT  System default language
				

MORE INFORMATION

The following information is taken from the WINNLS.H file.
   A language ID is a 16-bit value that is the combination of a
   primary language ID and a secondary language ID.  The bits are
   allocated as follows:

      +-----------------------+-------------------------+
      |      Sublanguage ID   |   Primary Language ID   |
      +-----------------------+-------------------------+
       15                   10 9                       0   bit

   Language ID creation/extraction macros:

      MAKELANGID    - Construct language ID from primary language ID and
                      sublanguage ID.
      PRIMARYLANGID - Extract primary language ID from a language ID.
      SUBLANGID     - Extract sublanguage ID from a language ID.

The macros are defined as follows

   #define MAKELANGID(p, s)       ((((USHORT)(s)) << 10) | (USHORT)(p))
   #define PRIMARYLANGID(lgid)    ((USHORT)(lgid) & 0x3ff)
   #define SUBLANGID(lgid)        ((USHORT)(lgid) >> 10)
				

Modification Type:MinorLast Reviewed:2/11/2004
Keywords:KB89822