CoolDictionary.com Webster Dictionary with PRONUNCIATION and Sound!

Does anyone know how to get around Multiple language resources?

 
 
   

Question: We are creating an application using mfc in a shared dll. We would like to use the capability of a single .rc file to contain multiple languages. We then use SetThreadLocale to choose the desired language. We are trying to avoid using the MFCxLOC.DLL method as suggested in Technical Note 57: Localization of MFC Components. It states that we should include the MFC\INCLUDE\L.DEU (for example) in our RC command line. I have looked in the .rc files in this directory and I do not see anything that connects them to a specific language (the LANGUAGE statement). It appears that we would not be able to include more than one set of mfc language rc's in a given .exe or dll.

Am I wrong? Does anyone know how to get around this? Must I have separate


Answer: You're right. The procedures for localization of MFC as described by Microsoft is not consistent at all. I was just working on the same problem (- only my second language is Norwegian -) when I read your mail, and here's what I've come up with so far:

1. First I had to translate the MFC rc-files into norwegian. That couldn't be done in App.Studio, so I had to open them "As Text". However, this is not a problem for you, since the MFC resources are already translated to german.

2. Now, I'm linking MFC dynamically, and I guessed it would be a problem to have MFC load its english resources from the MFC DLL but the norwegian resources from my EXE. - So I decided to try to try to include both sets of resources in my own EXE, and prevent MFC from loading them from the DLL. First, I went into "Build", "Settings..." and removed the "_AFXDLL" flag from "Preprocessor definitions" under the "Resources" tab. This will force the standard MFC resources (english) to be included in your executable. Now I examined the settings in "View", "Resource Includes...". I figured out it was the

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

that now would enable including the MFC resources.

3. The next thing was to force it to include my norwegian resources as well, and I added the following statements to the bottom (of the "Compile-time directives"):

// Norwegian MFC resources #ifdef _WIN32 LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL #pragma code_page(1252) #undef __AFXRES_RC__ #undef __AFXPRINT_RC__ #undef __AFXCTL_RC__ #undef __AFXDB_RC__ #undef __AFXOLECL_RC__ #undef __AFXOLESV_RC__ #include "afxres.nor.rc" #include "afxprint.nor.rc" #include "afxctl.nor.rc" #include "afxdb.nor.rc" #include "afxolecl.nor.rc" #include "afxolesv.nor.rc" #endif //_WIN32

The #undef's are because each of the earlier included english resource files has an #ifndef/#define condition at the beginning, so without these, the norwegian resources would just not be compiled.

Also, I decided to name my files .nor.rc and put them directly on the MFC\INCLUDE directory instead of putting them in a L.NOR sub-directory, 'cos then I won't have to hardcode the path to those files!

Also I discovered only the "afxres.rc" was included in the original section, so I added the other ones there too, just to be sure.

This seems to work fine, allthough I have yet only tested it briefly.

Submit Your Own Answer!

Google





 
 
| Home | English Course Questions | English Grammar Questions | Teaching Esl Questions | Esl Exercise Questions | Esl General Questions | Esl How To Questions | Esl Learning Questions | Esl Lessons Questions | Esl Other Languages | Esl Pronounciation Questions | Learning Sign Language Questions | Esl Worksheets Questions | Esl Adult Questions | Esl Beginner Questions | Conversational English Questions | Site Map |