Library for MFC Applications' Localization Using Resource-Only DLLs


Multilingual Library adds multiple UI languages' support to your MFC application. Multilingual library uses resource-only DLLs (sometimes called satellite DLLs) to keep translated resources, automatically selects appropriate language according to Microsoft Windows settings, and automatically generates a menu for inclusion in your application with a list of available languages to allow a user to change the language. The library is quite easy to use because only minimal changes to the source code are required and it works with both EXE and DLL files.

How It Works

On the first run, Library finds available resource-only DLLs in the application directory, makes a list of available languages, and then selects the most suitable language according to Microsoft Windows language settings. It loads selected language UI resources from the corresponding resource-only DLL and then substitutes them for resources in the main EXE/DLL file. Toolkit saves the UI language setting in the Registry and the user can select other languages by using the menu from your application at any time.

Using the Code

Naming convention

To use Multilingual Library, you have to name satellite DLLs as Filename.LNG, where LNG is a two or three character code that identifies language (For example, English is EN, English-United States is ENU, and Russian is RU).

  1. Link to multilang.lib
  2. Initialize Multilingual Library
  3. Add language selection menu to your application.
  4. Add Multilingual Library to your application's DLL with resources.
  5. Create and translate resource-only DLLs

Add Multilingual Library for resource-only DLLs to an EXE MFC application

Link MFC application to Lingobit Localization Toolkit

  1. On the Project menu, click YourProjectName Properties.
  2. On the left pane, select Linker and then Input.
  3. On the right pane, select Additional Dependencies.
  4. Add path to multilang.lib to the Additional Dependencies.

Changes to the source code of executable file (*.exe)

  1. Add the following line to the beginning of MainFrm.cpp:
  2. #include "MultiLang.h"
  3. Add the following code between BEGIN_MESSAGE_MAP ( CMainFrame , CFrameWnd ) and END_MESSAGE_MAP () in MainFrm .cpp:
  5. Add the following code to the MainFrm.cpp:
  6. void CMainFrame :: OnLanguageFirst ( UINT nID )
       MultiLangOnClickMenu ( nID );
       AfxMessageBox ( _T ("Please restart application for
                            changes to take effect"));
    void CMainFrame :: OnUpdateLanguageFirst
       ( CCmdUI * pCmdUI )
       MultiLang UpdateMenu ( pCmdUI );
  7. Add the following lines to the stdafx.h:
  8. #define ID_LANGUAGE_FIRST 32000
    #define MAX_LANGUAGES 100

    IDs from ID_LANGUAGE_FIRST to ID_LANGUAGE_FIRST+MAX_LANGUAGES will be used by thr Multilang Toolkit and should not be used for other purposes in your application.

  9. Add a menu item with ID_LANGUAGE_FIRST to the application menu.
  10. Add the following line to the beginning of YourApplicationName.cpp:
  11. #include "MultiLang.h"
  12. Call the Multilang Library initialization after CWinApp::InitInstance() in the InitInstance() function in YourApplicationName.cpp.

Add the Multilingual Toolkit for resource-only DLLs to the MFC extension DLL

Link the MFC Extension DLL to Lingobit Localization Toolkit:

  1. On the Project menu, click YourProjectName Properties.
  2. On the left pane, select Linker and then Input.
  3. On the right pane, select Additional Dependencies.
  4. Add a path to multilang.lib to the Additional Dependencies.

Changes to the source code of the MFC Extension DLLs files:

  1. Add the following line to the beginning of YourDLLName.cpp:
  2. #include "MultiLang.h"
  3. Add the following line between
  4. if (!AfxInitExtensionModule(YourDLLNameDLL, hInstance))
       return 0;


    new CDynLinkLibrary(YourDLLNameDLL);

    in the DllMain function in YourDllName.cpp.

    YourDLLNameDLL.hResource = MultiLangLoadLibrary(hInstance,

Create a Resource-Only DLL

There are several ways to create resource-only DLLs.

Manual creation of resource-only DLLs

To create a resource-only DLL, follow these steps:

  1. Create an empty DLL project.
    • In Visual Studio 6, create a "Win32 Dynamic-Link Library" with "An empty DLL project" selected.
    • In VS .NET or VS 2005, use "Win32 Project" in the "Visual C++ Projects" group, and select Application type "DLL" under "Application Settings".
  2. Add the linker option /NOENTRY to the linker settings for each build.
    • In VS 6, add "/NOENTRY" to the "Project Options" edit field in the Project Settings/Linker/Customize tab of the "Project Settings" dialog.
    • In VS.NET or VS 2005, add "/NOENTRY" to the "Additional Options" edit field in the Configuration Properties/Linker/Command line tab of the project properties dialog.
  3. Create a resource file.
    • In VS 6, create a new "Resource Script" and enter a file name with the extension ".rc".
    • In VS .NET or VS 2005, create a new "Resource File (.rc)" and enter a file name with the extension ".rc".
  4. Copy all the native-language resources from your application to your new resource file.
  5. Change the language of each resource to that of the resource-only DLL, and change the text, dialogs, and bitmaps as required.

For more information, see the "resource-only DLLs" topics in MSDN help.

Automatic Creation of Resource-Only DLLs

You can use Lingobit Localizer, an innovative software localization tool, to simplify and speed up creation of resource-only DLLs. Lingobit Localizer creates resource-only DLLs in three easy steps without any changes to the source code. Lingobit Localizer not only helps with creation of resource-only DLLs, but also assists in localizability testing, translation, QA checks, and collaboration with translators. You can read about it at

Points of Interest

  1. Lingobit Localizer - Software Localization Toolkit
  2. MSDN


2006-06-30: Multilingual Library 1.0 is released.

About the Author

Sergey Markov

I am a senior developer at Lingobit Technologes, leading software provider for localization industry.



  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Hurricane Sandy was one of the most destructive natural disasters that the United States has ever experienced. Read this success story to learn how Datto protected its partners and their customers with proactive business continuity planning, heroic employee efforts, and the right mix of technology and support. With storm surges over 12 feet, winds that exceeded 90 mph, and a diameter spanning more than 900 miles, Sandy resulted in power outages to approximately 7.5 million people, and caused an estimated $50 …

  • Today's competitive marketplace requires the organization to frequently release and deploy applications at the pace of user demands, with reduced cost, risk, and increased quality. This book defines the basics of application release and deployment, and provides best practices for implementation with resources for a deeper dive. Inside you will find: The business and technical drivers behind automated application release and deployment. Evaluation guides for application release and deployment solutions. …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds