什么技术可以最省力地实现现有 Delphi 应用程序的国际化(至少是多语言)?
我已经开发了大约 300 个应用程序,我希望为它们提供独立于操作系统的多语言功能。 我编写了一个即时翻译器,但在具有许多组件的应用程序中速度太慢。 你建议我做什么?
I have developed about 300 Applications which I would like to provide with multi-language capabilities independent from the Operating System. I have written a just-in-time translator, but that is too slow in applications with many components. What would you suggest I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我们正在使用 TsiLang 并且对此非常满意。
最好的一点是,您可以使用字典(您从现有翻译中填充)来预翻译项目。
We are using TsiLang and are very happy with it.
One of the best points is that you can pretranslate the project with a dictionary (which you filled from existing translations).
我听说 TsiLang 组件 很好,但您正在寻找一个就地解决方案。 ..
我使用了 GNU gettext for Delphi ,它完全符合你想要的功能,它加载翻译文本文件并替换组件中的文本。 它甚至有一个 pas/dfm 扫描仪来自动生成英文翻译文件。
还可以自动更改您的 pascal 源代码以注入 gettext 过程来代替静态字符串。 如果我没有记错的话,它只是添加一个下划线作为函数,如下所示。
我必须说,距离我上次使用这种方法已经有两年了。
有一件事仍然存在问题,Delphi 组件未启用 unicode(D2009 修复了此问题),因此当您不更改组件时,您对其他语言的支持仍然有限。
I've heard that the TsiLang components are nice, but your looking at an inplace solution...
I've used GNU gettext for Delphi which does exactly the thing you want, it loads the translations from a text file and replaces the text in your components. It even has a pas/dfm scanner to automatically generate the English translation file.
It's also possible to automatically change your pascal source code to inject the gettext procedure inplace of your static strings. If I'm not mistaken it just adds a underscore as function to it, as below.
I must say it has been 2 years since I last used this method.
One thing will remain problematic, the Delphi components are not unicode enabled (D2009 fixes this), so when you don't change the components you'll still have limited support for other languages.
一个好的免费解决方案是 GNU gettext for Delphi。 它具有 TsiLang 中不存在的一些功能 - 例如,您可以将如何计算事物的知识(一、二、四、百二、许多...的不同结尾)放入翻译文件中,这样您就不会'不必教每个程序来了解这些东西。
Delphi 部分的许可证非常宽松,但我不确定包含的 GNU 内容会对您的应用程序产生多大影响。
A good free solution would be GNU gettext for Delphi. It has some capabilities not present in TsiLang - for example, you can put the knowledge on how to count things (different endings for one, two, four, hundred and two, many ...) into the translation file so that you don't have to teach each program to know this stuff.
License for the Delphi part is very permissive but I'm not sure how much the included GNU stuff will affect your application.
获取Multilizer。 它是用 Delphi 制作的,可以像其他程序一样处理 Delphi 程序,并特别支持 VCL。 您甚至可以为每种语言轻松重做屏幕。 通过 Multilizer,您可以使用不同的技术来翻译和运行您的程序。
Get Multilizer. It is made in Delphi and it can handle Delphi programs like no other with special support for VCL. You can even redo your screens easy for every language. With Multilizer you can use different techniques to translate and run your program.
Delphi 2009 添加了集成翻译环境/外部翻译管理器
ITE 和 ETM 现在可用于 Delphi 和 C++Builder。
在 Codegear 的文章:What's New in Delphi and C++Builder 2009 中,他们指出:
当我想要将我的产品国际化时,这就是我计划首先尝试的方法。
然而,对我来说最简单的部分是翻译程序。 困难的部分是翻译帮助文件。
Delphi 2009 has added an Integrated Translation Environment/External Translation Manager
ITE and ETM are now available for both Delphi and C++Builder.
In Codegear's article: What's New in Delphi and C++Builder 2009, they state:
This is what I plan to try first once I am at the point that I want to Internationalize my product.
However, to me the easy part is to translate the program. The hard part is to translate the help file.
我会说GNU gettext for Delphi与TMS Unicode 组件包(以前在 TntWare 下免费)以获得组件中的 unicode 支持。
要使用或让翻译人员使用 gettext 文件,我建议查看免费的跨平台 Poedit可以编辑 .po 文件。
I would say GNU gettext for Delphi in combination with TMS Unicode Component Pack (previously free under TntWare) to get unicode support in the components.
To work with, or have translators work with, the gettext files I recommend looking at the free cross-platform Poedit that may edit the .po files.
如果您拥有 DexExpress 组件,只需提及 cxLocalizer 。
Just to mention cxLocalizer if you own DexExpress components.