Making an MFC application international

2020-03-04 08:52发布

I've got several large MFC applications here, and converting them into any other format is out of the question. We're expanding into other markets, and would like to make the apps work in other languages and cultures.

So far, I've found occasional references as to what to do with Visual C++ version 6, with one mention that later versions of MFC have additional relevant features. Searching MSDN gives me instructions on how to convert the apps to Unicode, which we already did. I found nothing on MSDN on how to make languages multilingual once they're in Unicode, only a few older things using Google, and one book about internationalization using VC++6. (We're using Visual Studio 2008 now, on XP and Vista.)

I make no claims for the strength of my Google-fu, and would be happy to be directed to things I've missed.

Is it reasonable to use the methods of VC++6, or should I use later features?

If I should use features later than that, where can I find some reference to them?

Is there something I should worry about other than setting the locale, converting all strings to resources, and duplicating resources in different languages?

I can find more things about .NET internationalization, but I'm inexperienced in .NET. What will I find there that's applicable to VC++ and MFC?

Edit: I just ran into difficulties trying to put Unicode strings into the String Table resource. (As far as I can tell, Unicode strings need to be entered into the .rc file with a text editor, in L"0x0034" form. I haven't found a resource editor way to do that.) Any tips on that? Any other resource I can use in VS2008 using VC++ and MFC?

Edit: Somebody on a Microsoft forum suggested that I open the offending .rc file in Notepad, and save it in Unicode. Unfortunately, this doesn't seem to fix the dialogs, although the stringtable seems to be working in Japanese.

4条回答
Root(大扎)
2楼-- · 2020-03-04 09:24

You can also create a resource only dll

See How To Create Localized Resource DLLs for MFC Application for more details.

查看更多
Animai°情兽
3楼-- · 2020-03-04 09:34

Here's a CodeProject article of mine that describes very "coding-efficient" method to pull strings from the string table (required for translatable texts): http://www.codeproject.com/KB/string/stringtable.aspx

Here's another class that help your app pick the right UI language. It also helps you create a language selection menu: http://www.codeproject.com/KB/locale/LanguageMenu.aspx

Last but not least, appTranslator is a tool that helps you translate the UI of your app, detect what changes were made in resources since the last version, create translated exe or resource DLLs and much more: http://www.apptranslator.com

(Note: I'm the author of appTranslator.)

查看更多
We Are One
4楼-- · 2020-03-04 09:36

You can internationalize your application using the following ways.

After you converted the application to unicode (you already did) and all the strings should be loaded from String table.

  1. For each language you need to change the string table and compile

  2. One more way is to maintain a XML file which contains all the strings in the localized format. Load the xml and strings depending on the language.

查看更多
小情绪 Triste *
5楼-- · 2020-03-04 09:39

There's a lot more than just translating "strings" to internationalize an application.

Most of your UI will need to be updated to take into account the different text lengths, and language orientation (thing Hebrew, Chinese, Arabic, ...)

Some images will also need to be changed to fit a different culture (unfortunately, I don't have an example for that), either the figurative is different or the colors do not fit local specifications.

We are using a tool like appTranslator to help us do the cosmetic localization (UI re-formatting) and use a professional technical translator for the strings.

查看更多
登录 后发表回答