如何使用Delphi的内置多语言支持? [英] How to use Delphi's built-in multilingual support?
问题描述
我从版本2开始使用Delphi,现在在版本XE3上使用.
I use Delphi since version 2 and now on the version XE3.
自BSD2006
起,我已经注意到Project
主菜单上的Languages
菜单.现在,我有兴趣构建一个以英语,葡萄牙语和西班牙语提供的应用程序,我在Internet上搜索了教程,但找不到有关此功能的任何信息,仅第三个派对组件和向导.由于英语不是我的母语,所以我什至不知道如何找到合适的术语来使用此Delphi工具.
Since BSD2006
I've noticed this menu Languages
on the Project
main menu. Now that I am interested in build an application available in English, Portuguese and Spanish, I searched for tutorials on the Internet but couldn't find anything about this function, only third party components and wizards. Since English is not my first language, I don't even know how to look for the right terms in order to get to this Delphi tool.
有人使用过此工具吗?在哪里可以找到合适的入门指南?谢谢.
Does anyone already used this tool? Where Can I find a proper tutorial to get started? Thanks.
响应
由于雷米(Remy)的回答正确,但是通过链接,我将继续它,以便其他人可以快速访问它:
Since Remy answered correctly, but with a link, I will resume it so other can get to it quickly:
- 保存所有项目文件
- 转到菜单>项目>语言>添加
- 根据需要添加尽可能多的语言
- 转到菜单>视图>项目管理器
- 您将看到您的项目以及您创建的每种语言的项目
- 展开一个语言项目,您会看到
DFM
文件来翻译表格 - 右键单击并打开一个,您将看到翻译编辑器
- 翻译所有需要的字符串,然后保存文件
- 再次在项目管理器中展开.\ Win32 \ Debug \并查看
RC
资源文件 - 右键单击一个,然后编辑应用程序的所有units文件的常量字符串
- Save all your project files
- Go to Menu > Project > Languages > Add
- Add as many languages as you need
- Go to Menu > View > Project Manager
- You will see your project plus a project for each language you created
- Expand one language project and you will see the
DFM
files to translate your forms - Right click and open one and you will see the Translation Editor
- Translate all the needed strings and then save the file
- Again in the Project manager expand .\Win32\Debug\ and see the
RC
resource files - Right click one and edit the constant strings of all the units files of your app
更多提示:
-
为了将自己单位的字符串放入翻译列表文件,您必须将它们创建为常量,但不使用
consts
保留字,而是使用resourcestring
保留字,例如:resourcestring Str1 = 'Test'; StrN = '%s strings found';
In order to get the strings of your own units into the translation list file, you have to create them as constants, but using not the
consts
reserved word, but theresourcestring
one, like:resourcestring Str1 = 'Test'; StrN = '%s strings found';
每次创建新的resourcestring
或在表单上添加可视组件时,都必须更新语言元数据,并且要执行此操作,请转到菜单>项目>语言>更新本地化项目
Every time you create a new resourcestring
or add a visual component on a form, you have to update the languages metadata, and to do it, go to Menu > Project > Languages > Update Localized Projects
每次完成对语言文件中术语的翻译时,不仅需要保存这些文件,还必须重新构建它们所属的项目.如果转到菜单>项目>构建所有项目
Every time you finish to translate the terms on your language files, you not just have to save those files, but you have to re-build the projects they belong. It's easier if you go to Menu > Project > Build All Projects
这些提示在Embarcadero帮助中未作解释.谢谢雷米!
推荐答案
从阅读文档开始:
这篇关于如何使用Delphi的内置多语言支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!