Using A Resource File

Character Codes

Characters are represented by character codes. Character codes are generated and stored when a user inputs a document. Single-byte character sets provide 256 character codes, which is adequate for encoding most of the characters needed for other languages. For example, the Windows Extended ANSI character set contains 256 characters consisting of Latin letters , Arabic numerals, punctuation, and drawing characters.

However, 256 character codes are not enough to represent all the characters needed by multilingual users in a single font, or by users in the Far East, where more than 12,000 characters may need to be addressed at any one time. Consequently, multibyte character sets (commonly known as double-byte character sets) are necessary.

Unicode Format

All strings in a resource file are stored in Unicode format. Unicode allows a larger range of characters to be addressed than is possible using single-byte character encoding. All Unicode values are double-byte, which simplifies the way a Unicode-based system reads a string of text.

Windows NT uses Unicode internally for character encoding. However, Windows 95 does not use Unicode for character encoding.

Example

This example converts a string value to Unicode format in Visual Basic. The StrConv can be used with the vbUnicode constant:

 strUnicodeValue = StrConv("String Value", vbUnicode) 

Example

This example converts a Unicode value to an ANSI string. The vbFromUnicode constant is used.

 StrANSIvalue = StrConv(strUnicodeValue, vbFromUnicode) 

Lesson Summary

Localization adapts a software product for use in another language. Screen information and documentation, Help files, scenarios, templates, models, sample files, icons, and symbols must be localized. A practical method for separating localizable information is through the use of resource files, which allow you to use functions instead of string literals, pictures, and data. The resources reside in one file, making it possible to localize without accessing source code or recompiling the application. Resource strings are stored in Unicode format in order to support multibyte character sets used by some languages.



Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net