Search code examples
dlllocalizationmfc

How do I localize CMFCWindowsManagerDialog in Portuguese?


We have added the Portuguese language to our app. We use this built-in MFC dialog, CMFCWindowsManagerDialog

enter image description here

Until now it hasn't been a problem because these languages

l.chs l.cht l.deu l.esn l.fra l.ita l.jpn l.kor l.rus

are automatically supported, but that's it, there's no Portuguese. I understand that creating a satellite resource DLL is probably the answer. I'm not familiar with that term, but we have resource DLLS for each project in each language, so I assume those are "satellite DLLs", and I know how to make them. But I don't understand how to do it with this built-in dialog. We have to localize CMFCToolBarsCustomizeDialog also, but I don't know where to begin. Any help would be greatly appreciated.


Solution

  • I use appTranslator to maintain all my satellite DLL files and it automatically manages this for you. Sadly it is no longer available commercially.

    There are other bespoke localisation software packages out there though (like Lingobit) that also manages MFC translations in a nice GUI environment.

    It does all revolve around Resource Only DLL files and this article on CodeProject explains how to make a resource only DLL.


    I have an MDI application which uses appTranslator and it does have the window you refer to:

    enter image description here

    In Visual Studio, if you right-click your resource file in the Resource View and select Resource Includes:

    enter image description here

    You will be presented with a dialog. In my case:

    enter image description here

    Notice the inclusion of the afxribbon.rc resource? This contains the dialog in question. Here is my complete inclusion code for reference:

    #define _AFX_NO_OLE_RESOURCES
    #define _AFX_NO_TRACKER_RESOURCES
    #define _AFX_NO_PROPERTY_RESOURCES
    
    #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
    #ifdef _WIN32
    LANGUAGE 9, 1
    #pragma code_page(1252)
    #endif //_WIN32
    #include "res\CommunityTalks.rc2"  // non-Microsoft Visual C++ edited resources
    #include "afxres.rc"         // Standard components
    #include "afxprint.rc"       // printing/print preview resources
    #include "indicate.rc"
    #include "prompts.rc"
    #endif
    
    #if !defined(_AFXDLL)
    #include "afxribbon.rc" // MFC ribbon and control bar resources
    #endif
    

    The trick is to add the required AFX system resource into your application. Then it will be exposed for appTranslator and / or Lingobit to translate.