Platform SDK: International Features |
If you want your application to change the UI language, you should consider using satellite resource DLLs. In this method, each supported language has its resources in a separate DLL. Each DLL uses the same resource identifiers, but also contains strings (and possibly other language or locale-dependent resources) in the appropriate language. The name of each DLL indicates the language of its resources. On Windows 2000, your application can call EnumSystemLanguageGroups to determine which languages are supported, and thus decide which of the resource DLLs to install.
To load and get a handle to the DLL of a language, call LoadLibraryEx. Thereafter, this handle is used in all calls to load resources. However, when implementing multilanguage UI on both Windows 95/98 and Windows NT, be aware of platform differences in some Win32 API functions. For example, it is desirable to load the resource-only DLLs as data files without referencing any executable code. But on Windows 95/98, LoadLibraryEx requires the module handle returned with the lower level resource functions such as FindResource and LoadResource. Since the resource DLLs cannot be loaded as data files, each DLL must have a dummy DLLMain.
Also, you must decide on a default language for your application to use during application initialization. This requires a fallback in case the requested language is not available. To detect which UI languages are installed on Windows 2000, call EnumUILanguages. To determine the user default and system default UI languages, use GetUserDefaultUILanguage and GetSystemDefaultUILanguage, respectively. For earlier platforms, check the registry to determine the interface language of the system: on Windows 95/98, use the language of the resource locale (HKEY_CURRENT_USER\Control Panel\desktop\ResourceLocale) and on Windows NT use the locale of the default user (HKEY_USERS\.DEFAULT\Control Panel\International\Locale).
Typically, the user can change the UI language of the application. Thus you must also implement a method to find all resource DLLs that match the naming convention (because you may not have installed all of them). Another issue is whether to add, remove, or modify UI elements when changing the UI language. For example, you must decide whether to have only one accelerator table for all languages or a separate accelerator table for each one. Having only one table simplifies development and helps users who use the application with more than one UI language. However, it can lead to accelerator keys that are not clearly related in all languages to the functionality that is initiated.