The localization mechanism provides a very simple and robust way to create multilingual applications.
BCGControlBar language pack files:
The localization files are located in BCGCBPro\L.* directories, where * - language name prefix (FRA - French, ITA - Italian, ...).
Language-specific resource DLLs are located in your BCGControlBar\Bin directory:
DLL name |
Language |
BCGCBProResCAT.dll | Catalan |
BCGCBProResCHS.dll | Chinese |
BCGCBProResCSY.dll | Czech |
BCGCBProResDEN.dll | Danish |
BCGCBProResDEU.dll | German |
BCGCBProResDUT.dll | Dutch |
BCGCBProResELL.dll | Greek |
BCGCBProResESP.dll | Spanish |
BCGCBProResFRA.dll | French |
BCGCBProResHEB.dll | Hebrew |
BCGCBProResHUN.dll | Hungarian |
DLL name |
Language |
BCGCBProResITA.dll | Italian |
BCGCBProResJPN.dll | Japanese |
BCGCBProResKOR.dll | Korean |
BCGCBProResPLK.dll | Polish |
BCGCBProResPTB.dll | Portuguese (Brazil) |
BCGCBProResPTG.dll | Portuguese |
BCGCBProResROM.dll | Romanian |
BCGCBProResRUS.dll | Russian |
BCGCBProResSKY.dll | Slovak |
BCGCBProResSLV.dll | Slovenian |
BCGCBProResTRK.dll | Turkish |
Localization with BCGControlBar DLL version:
- Add the following member to your application class:
HINSTANCE m_hinstBCGCBProRes;
- In the application's InitiInstance () add the DLL resource initialization:
m_hinstBCGCBProRes = LoadLibrary(
_T("BCGCBProRes***.dll"));
// *** - language
BCGCBProSetResourceHandle(
m_hinstBCGCBProRes);
- Unload resource DLL in ExitInstance:
FreeLibrary(m_hinstBCGCBProRes);
If you're using translations generated by our Translator tool, you can specify the BCGControlBar language DLL path in the translation XML,
and this DLL will be automatically loaded by the framework.
Localization with BCGControlBar static library version:
In the project's "Resource Includes" dialog (View | Resource Includes) modify
#include "BCGCBPro.rc"
to
#include "L.***\BCGControlBar.rc"
// *** language
#pragma code_page(code)
e.g.
#include "L.FRA\BCGControlBar.rc"
#pragma codepage(1252)
How to translate the library resources to the new language?
- Under your BCGControlBar directory, create new subdirectory called "L.***" where "***" is the language name prefix.
- Copy the following files from the any other existing language directory:
- BCGCBRes.dsp
- BCGCBRes.dsw
- Copy BCGCBPro.rc (English resources) from
BCGControlBar directory. Rename it to BCGControlBar.rc
- In the Visual C++, open BCGCBRes project
- Remove resource version info
- Change the DLL output file name to "..\..\bin\BCGCBProRes***.dll" (*** - is the language name prefix)
- Translate the dialog, string and menu resources.
- Build the project. Because BCGControlBar.rc has references to the common BCGControlBar resources (bitmaps, icons and cursors), you'll be notified
about creating a "RES" subdirectory. This is a Visual Studio resource editor
problem - it doesn't interpret path obtained from the project settings in
the correct way. Just answer yes and L.***\RES will be created. When the
resource file is complied (both static and DLL mode), the correct RES path
(BCGControlBar dir\RES) will be taken. The language resources DLL will be
placed into the BIN directory.
How to localize your application resources?
- Launch our Translator application and add translations for the required languages.
- If you're going to utilize the automatic translations in the dialogs or forms, please call the following method in the dialog class constructor:
EnableControlsTranslation(); // The framework will use the translation manager to draw control labels
- Add the following code to the command handler for language changes (e.g., menu items "View | Language | Language 1"):
BCGPTRANSLATE_MGR.SetTranslation(IDR_LANG); // IDR_LANG - id of XML resource generated by the Translator
Please take a look at our sample application MultiLanguageDemo to see how this mechanism works.
Back to the Developer Area