|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Localized Resources in MFC Applications: Satellite DLLs
MFC version 7.0 provides enhanced support for satellite DLLs, a feature that helps in creating applications localized for multiple languages. A satellite DLL is a resource-only DLL that contains an application's resources localized for a particular language. When the application begins executing, MFC automatically loads the localized resource most appropriate for the environment. For example, you could have an application with English language resources with two satellite DLLs, one containing a French translation of your resources and the other containing a German translation. When the application is run on an English language system, it uses the English resources. If run on a French system, it uses the French resources; if run on a German system, it uses the German resources.
To support localized resources in an MFC application, MFC attempts to load a satellite DLL containing resources localized to a specific language. Satellite DLLs are named ApplicationNameXXX.dll, where ApplicationName is the name of the .exe or .dll using MFC, and XXX is the three-letter code for the language of the resources (for example, 'ENU' or 'DEU').
MFC attempts to load the resource DLL for each of the following languages in order, stopping when it finds one:
- (Windows 2000 or later only) The current user's default UI language, as returned from the GetUserDefaultUILanguage() Win32 API.
- (Windows 2000 or later only) The current user's default UI language, without any specific sublanguage (that is, ENC [Canadian English] becomes ENU [U.S. English]).
- The system's default UI language. On Windows 2000 or higher, this is returned from the GetSystemDefaultUILanguage() API. On other platforms, this is the language of the OS itself.
- The system's default UI language, without any specific sublanguage.
- A "fake" language with the 3-letter code LOC.
If MFC does not find any satellite DLLs, it uses whatever resources are contained in the application itself.
As an example, suppose that an application LangExample.exe uses MFC and is running on a Windows 2000 multiple user-interface system; the system UI language is ENU [U.S. English] and the current user's UI language is set to FRC [Canadian French]. MFC will look for the following DLLs in the following order:
- LangExampleFRC.dll (user's UI language).
- LangExampleFRA.dll (user's UI language without the sublanguage, in this example French (France).
- LangExampleENU.dll (system's UI language).
If none of these DLLs are found, MFC will just use the resources in LangExample.exe