0
votes

Before anyone bashes me with, read this first and that second, I have tried following links below to achieve internationalization with MFC.

Creating resourse DLL: Localization of MFC Components http://msdn.microsoft.com/en-us/library/x6h91d9w.aspx

Localization for older MFC htp://support.microsoft.com/kb/198846/en-us

I am new to MFC so please be kind with your answers. So in order to get localization with MFC 7 and above I followed these steps. (Currently using MFC with Visual Studio11)

  1. Created a MFC Project (MyApp) with MFC in a shared DLL
  2. To add a another language (German) to the app, I created a win32 Dll project (MyAppDEU)
  3. Copied the resource file (MyApp.rc) inside same folder and renamed it MyAppDEU.rc
  4. Added the MyAppDEU.rc file to the dll project
  5. In resource view of MyAppDEU.rc, changed the VS_VERSION_INFO -> Block header to "Deutsch (000704b0)"
  6. Changed some strings in the string table to see the difference when the main app loads
  7. Changed the ouput of the MyAppDEU project to build inside the MyApp Output folder
  8. Compiled MyAppDEU to get the Dll
  9. Compiled MyApp with and without following the instructions from point 9 http://support.microsoft.com/kb/198846/en-us

So with all these done, I failed to see any difference in my Application. It loads with the English resouce file which I created the App with. My computer has a German Windows 8 OS. From what I know MFC has inbuilt multilanguage support with Satellite Dlls. I have the correct naming format ApplicationNameXXX.dll. The dlls are in the same directory as the exe.

I hope someone can see what Im doing wrong or missing here. I am fairly new to MFC and appreciate any help regarding this.

2

2 Answers

1
votes

[answer adaapted from this SO answer]

I have used a slightly different approach successfully, skipping the MFC inbuilt multilanguage support with Satellite DLLs.

We have multiple DLL projects in our solution, each one containing just one set of resources for a single language (e.g.: AppRes_ENU.DLL). At run-time InitInstance(), we select the appropriate language DLL with code like

CString sResourceDllName;
// format sResourceDllName according to the language ("%s\AppRes_%s.DLL")
hInst_aRes = LoadLibrary(sResourceDllName);
if (hInst_aRes == NULL)
{    // handle <resoure-DLL not available>
     return FALSE;
}
AfxSetResourceHandle(hInst_aRes);

and use hInst_aRes to load strings, dialog boxes, ...

0
votes

Have a look at this software: http://www.apptranslator.com/ . It helps with localisation using satellite dll's; the documentation probably describes how to do it. It's quite simple once you figure our the relationships between ::AfxGetResourceHandle() and hInstanceHandle and all that jazz - the easiest way to learn about that is to read the MFC source. Then you write a few helper classes and off you go :)