0

I have a large application which i want to migrate to Arabic. I have defined the strings that we show to the user under the resourcestring keyword.

I am using the External Translation manager provided with Delphi 6. However, I am not very much comfortable using the tool. I want to create a resource only dll with all the translated strings like how the Delphi ETM does, and then switch between languages at run-time at the click of a button.

I was able to link the resourcestrings to the Dll, but how about form's captions and hints and the component properties? I am loading the Dll at runtime depending on the language, but the form properties are not reflecting as they were not available in the Dll.

Any pointers in the right direction ???

Thanks Rahul W

4

1 回答 1

1

Delphi 本地化工具和运行时支持所做的是将资源加载(包括表单)从可执行文件重定向到 DLL。表单、它们的组件和控件(非默认属性)作为资源存储到可执行文件中(只要您没有在运行时完全创建它们 - 但是您必须一一设置它们的属性)。

因此,如果您想像标准翻译工具一样工作,则必须以相同的方式工作。DLL 资源向导所做的是将所有项目 .dfm(以及您手动添加的那些)和资源字符串提取到可以本地化的副本中。当应用程序启动时,表单加载代码会检查 .dfm 应该从哪里加载。您应该覆盖此代码以加载您的资源。

请注意,在运行时更改语言可能需要不同的方法,因为从资源加载整个表单可能会将其“重置”到创建状态。另一方面,与 gettext 之类的方法相比,它允许本地化的内容远远超过表单文本,包括图像、颜色,并且可以轻松地使控件大小适应新字符串。恕我直言 gettext 适用于简单的需求,但是当本地化成为一项复杂的任务并且您可能需要针对非常不同的“文化”进行本地化时,就需要更强大的工具。

于 2012-01-05T19:44:06.037 回答