Strings

[New for Windows NT 4.0 Service Pack 3.]

The Strings section defines one or more string keys. A string key represents a string of printable characters.

The Strings section simplifies translation of strings for international markets by placing all strings that can be displayed at the user interface in a single section of the INF file. String keys should be used whenever possible.

The setup functions also support language-specific strings sections, enabling you to specifiy substitution strings for multiple languages in a single INF file.

[Strings[.langid]]
strings-key=value
.
.
.
 
langid
An optional parameter that specifies a language identifier for the Strings section. This identifier must be expressed as a four-digit hexadecimal number. For example, U.S. English is 0409 and Standard French is 040c.
strings-key
A unique name consisting of letters and digits.
value
A string consisting of letters, digits, or other printable characters. It should be enclosed in double quotation marks if the corresponding string key is used in an item that requires double quotation marks.

The following example shows the Strings section of a typical INF file.

[Strings]
String0="Corporation X"
String1="Corporation X"
String2="CS2590 SCSI Adapter"
 

The langid parameter enables you to specify several Strings sections in a single INF file. For example, you could specify two Strings sections, one for French and one for English, in a single INF file, enabling you to distribute the same INF file to both markets.

The setup functions match the language identifer returned by GetThreadLocale to a Strings section whose langid parameter is the best match. Matches are attempted in the following order:

  1. A langid parameter that exactly matches the identifier returned by the GetThreadLocale function. For example, if the current language is U.S. English (0409), then an exact match would be [Strings.0409].
  2. A langid parameter that contains only the primary part of the language identifier and matches the primary part of the identifier returned by the GetThreadLocale function. For example, if the current language is U.S. English (0409), and no [Strings.0409] section exists, the next best match would be [Strings.0009].

    Note A langid parameter that contains only the primary part of a language identifier will typically not be a valid language identifier. However, you can use it to specify a default Strings section for a group of languages. For example, 000c would be the default for all French locales, including Canadian, Belgian, Swiss, and Standard French.

  3. The first-encountered langid whose primary part matches the primary part of the identifier returned by the GetThreadLocale function. For example, if the current language is U.S. English (0409) and no [Strings.0409] or [Strings.0009] section exists, then the setup functions would use either [Strings.0809] or [Strings.0c09], depending on which appeared first in the INF file.
  4. If none of the preceding attempts produces a match, use the [Strings] section.

For example, consider a case in which you want to specify strings for American English, have all non-American English languages, such as Australian English and Canadian English, use British English, and all non-English languages use Standard French. You could include the following sections in your INF file:

[Strings.0409]
; American English strings
S1 = "Hello"

[Strings.0009]
; British English strings
; Note that 0009 is used instead of 0809 to make this the default
; for English languages other than U.S. English.
S1 = "Greetings"

[Strings]
; French strings
; Not specifying a langid makes this the default
S1 = "Bonjour"
 

Remarks

Although the Strings section is usually the last section in an INF file, a key defined in a Strings section can be used anywhere in the INF file. The installer expands the string key to the specified string and uses it for further processing.

When you use a string key you must enclose it within percent signs (%). To use a % character in the string, use %%.

The Strings section is selected when the INF is opened and does not dynamically change if the current language changes. If the current language changes, you must close and reopen the INF file in order to change the substitution strings used by the setup functions.

Windows 95: An INF file can contain Strings sections only for languages that share a single ANSI code page. The INF file is interpreted in the current system ANSI codepage.

Windows NT: An INF file can have Strings sections for any language, without restriction. However, if an INF file contains Strings sections with ANSI code pages that are different from each other or from the current ANSI code page, the file should be Unicode text.

See Also

Overview, INF File Format Reference