国际化在MFC [英] Internationalization in MFC

查看:251
本文介绍了国际化在MFC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后(多年推迟)之后,用英语以外的几种其他语言本地化了我的应用程序。



第一个挑战是将集成设计我的C ++ / MFC应用程序有几十个对话框和无数的字符串。我遇到了两种可能的替代实现:


  1. 编译和部署本地化的资源文件为DLL

  2. 提取并使用本地化版本替换所有字符串。对于每个
    语言,将有一个XML(或简单文本)文件。

我个人选择第二个选择,因为在我看来更加灵活。更改很多但不是很难,非常重要的XML文件将很容易为翻译修改。



任何建议都非常感谢。 >

请注意,

Cosmin Unguru

http:/ /www.batchphoto.com/

解决方案

我做了一些长期使用不同语言的MFC项目。
我强烈推荐第一种使用纯资源DLL的方法。



原因:



1)如果用户进行XCOPY安装,他总是在主要可执行文件中具有默认语言(英语)。



(2)如果你不翻译所有内容(例如你的发布迟到或忘记了一些字符串),Windows资源函数如果正确使用返回资源在默认语言自动 - 你不必自己实现它。



(3)我的个人意见:(a)XML文件中的换行符,制表符,空格在您的**中很痛苦。 (b)合并XML文件更糟...



(4)不要忘记编码。



现在主要的原因:



(5)您将必须重新排列许多对话框,因为许多字符串在eg中较长法语或德语比英语。



另一个提示:花一些钱,买一个翻译工具,导入你的项目/二进制和建立翻译​​数据库。这将在第一次发布后摊销。



另一个提示(2):如果可能,发布不包含任何更改,但只包含多语言功能。在将来,如果可能:用英语发布您的产品。然后在一个步骤(每种语言)中进行翻译,并发布其他语言。


It's finally (after years of postponing) the time to localize my app in a few other languages other than English.

The first challenge is to design the integration into my C++ / MFC application that has dozens of dialogs and countless strings. I came across two possible alternative implementations:

  1. Compile and deploy localized resource files as DLLs
  2. Extract and replace all strings with the localized version. For each language there will be an XML (or simple text) file.

Personally I opt for the second alternative since it seems to me more flexible. The changes are many but not hard to make, and very importantly the XML files will be very easy to modify for the translators.

Any advise is greatly appreciated.

Regards,
Cosmin Unguru
http://www.batchphoto.com/

解决方案

I did some long-living MFC projects with different languages. I strongly recommend the first approach with resource-only DLLs.

The reasons:

(1) If the user does a XCOPY install, he always has the default language (English) in the main executables.

(2) If you don't translate everything (e.g. you're late with your release or forget some strings), the Windows resource functions if properly used return the resource in the default language automatically - you don't have to implement it on your own.

(3) My very person opinion: (a) Line breaks, tabs, whitespaces in XML files are a pain in your a**. (b) Merging XML files is even worse...

(4) Don't forget the encoding. It's okay in XML but your translators might use an unsuitable editor and damage the file.

And now for the main reason:

(5) You will have to rearrange many of your dialogs, because many strings are longer in e.g. French or German than in English. And making all statics, buttons, ... larger "just in case" looks crappy.

Another hint: Spend some bucks and buy one of the translation tools which import your projects / binaries and build up a translation database. This will be amortized after the first release.

Another hint (2): If possible make a release which doesn't contain any changes but only the multi-language feature. Also in future, if possible: Release your product in English. Then do the translation in one single step (per language) and release the other languages.

这篇关于国际化在MFC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆