MFC 中的国际化
终于(经过多年的推迟)将我的应用本地化为英语以外的其他几种语言了.
It's finally (after years of postponing) the time to localize my app in a few other languages other than English.
第一个挑战是设计集成到我的 C++/MFC 应用程序中,该应用程序具有数十个对话框和无数字符串.我遇到了两种可能的替代实现:
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:
- 将本地化的资源文件编译并部署为 DLL
- 提取所有字符串并将其替换为本地化版本.对于每个语言会有一个 XML(或简单文本)文件.
我个人选择第二种选择,因为在我看来它更灵活.更改很多但并不难,而且非常重要的是,XML 文件对于翻译人员来说很容易修改.
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.
非常感谢任何建议.
问候,
Cosmin Unguru
http://www.batchphoto.com/
推荐答案
我用不同的语言做了一些长期存在的 MFC 项目.我强烈推荐使用纯资源 DLL 的第一种方法.
I did some long-living MFC projects with different languages. I strongly recommend the first approach with resource-only DLLs.
原因:
(1) 如果用户执行 XCOPY 安装,他在主可执行文件中始终使用默认语言(英语).
(1) If the user does a XCOPY install, he always has the default language (English) in the main executables.
(2) 如果您不翻译所有内容(例如,您发布迟了或忘记了某些字符串),如果使用得当,Windows 资源函数会自动以默认语言返回资源 - 您不必自行实施.
(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) 我个人的观点:(a) XML 文件中的换行符、制表符、空格对你来说是个痛点.(b) 合并 XML 文件更糟糕...
(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) 不要忘记编码.在 XML 中没问题,但您的翻译人员可能会使用不合适的编辑器并损坏文件.
(4) Don't forget the encoding. It's okay in XML but your translators might use an unsuitable editor and damage the file.
现在的主要原因是:
(5) 您将不得不重新排列许多对话框,因为许多字符串在例如法语或德语比英语.让所有的静态元素、按钮……以防万一"变大看起来很糟糕.
(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.
另一个提示 (2):如果可能,发布不包含任何更改但仅包含多语言功能的版本.将来,如果可能的话:发布您的英文产品.然后一步完成翻译(每种语言)并发布其他语言.
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.
相关文章