如何使用Delphi的内置多语言支持? [英] How to use Delphi's built-in multilingual support?

查看:177
本文介绍了如何使用Delphi的内置多语言支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从版本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:

  1. 保存所有项目文件
  2. 转到菜单>项目>语言>添加
  3. 根据需要添加尽可能多的语言
  4. 转到菜单>视图>项目管理器
  5. 您将看到您的项目以及您创建的每种语言的项目
  6. 展开一个语言项目,您会看到DFM文件来翻译表格
  7. 右键单击并打开一个,您将看到翻译编辑器
  8. 翻译所有需要的字符串,然后保存文件
  9. 再次在项目管理器中展开.\ Win32 \ Debug \并查看RC资源文件
  10. 右键单击一个,然后编辑应用程序的所有units文件的常量字符串
  1. Save all your project files
  2. Go to Menu > Project > Languages > Add
  3. Add as many languages as you need
  4. Go to Menu > View > Project Manager
  5. You will see your project plus a project for each language you created
  6. Expand one language project and you will see the DFM files to translate your forms
  7. Right click and open one and you will see the Translation Editor
  8. Translate all the needed strings and then save the file
  9. Again in the Project manager expand .\Win32\Debug\ and see the RC resource files
  10. 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 the resourcestring 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屋!

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