XAF应用开发教程(八) 汉化与多国语言支持
使用了XAF开发时,汉化是一个比较常的问题。
要实现汉化很简单:
1.在这里下载汉化资源文件。这里演示的版本是15.1.X的
2.文件下载后将:文件解压到目录 <你的项目>\BIN\ 下面。 解压后如下所示:
这一步的功能是:汉化多数控件中的使用的文字资源。这是官方提供的方法,也有些字符串是没有被汉化的。因为DEV支持的语言也不少,也制做了许多国家的语言包。但CN的资源包还没有做完全汉化。
注意:上例中是在web中,在Win中,同样需要将上面的文件解压过去。
3.XAF中内容的汉化,因为XAF是基于控件开发的,所以控件汉化也算是完成了一部分XAF的汉化。另外不在控件中的,就需要在XAFML中进行汉化了。
In this topic, you will learn how to localize a typical XAF application. We recommend that you review the Application Model Basics andLocalization Basics topics before proceeding. You can localize an XAF application in two ways.
- Directly in the Model Editor by translating each localizable value.
- Using the Localization Tool, which can be invoked from the Model Editor Toolbar. This tool gathers all the localizable values in one grid, and provides the import/export functionality as well as the ability to use the Microsoft Translator service.
These two approaches are described below. We recommend using the Localization Tool, because it makes the localization process quicker and more convenient.
Add the New Language Aspect and Localizable Resources to the Application Model
These are the initial steps that should be performed independent of the chosen localization approach.
- Localization of the XAF modules and DevExpress controls used in your XAF application is required. If the localized resources are available for the target language, you can use them. Otherwise, you should export the culture-specific resources to the Application Model, to enable the capability to localize them together with your custom text. Follow the recommendations described in theLocalize Standard XAF Modules and DevExpress Controls Used in an Application topic.
- Localizable resources of Windows Forms Templates are not available in the Application Model by default. To export them, modify the collection exposed by the Windows Forms module's ModuleBase.ResourcesExportedToModel property or application'sXafApplication.ResourcesExportedToModel property. You can use the Module or Application Designer for this purpose, respectively. You should add the "MainForm Template", "DetailViewForm Template", "NestedFrame Template", "LookupControl Template" and "PopupForm Template" items.
Note
Template resources include strings such as "File", "View", "Home" and "Tools", used in the application's main menus as well as the ribbon. If you see that the menu items in the standard form, or page and group captions in the ribbon form, are not translated, ensure that you have added and translated the template resources.
- If there are "hardcoded" strings visible in the application UI, it is recommended that you make them localizable. Refer to the How to: Localize Custom String Constants topic for details.
- Invoke the Model Editor for the module project. Add a new language via the Languages Manager, as described in the Localization Basics topic. Repeat this step for the platform-specific modules. Note that a Visual Studio restart is required to see localized text provided with satellite assemblies in the Model Editor.
Use the Localization Tool
We recommend that you begin the translation from the platform-agnostic module, and then proceed to the platform-specific modules. Follow the steps below to localize each of your XAF application modules with the Localization Tool.
Click the Localization button in the XAF Model Editor Toolbar. The expressApp Framework Localization window will be invoked.
This window provides the grid editor with all localizable property names, paths, descriptions and values. The toolbar with the set of commands is also provided. The grid columns and actions available in this window are described in the Localization Tool topic.
In the Localization window toolbar, select the target language via the Translation Language drop-down.
NoteIf you have successfully installed satellite assemblies for the target language, you will see that text supplied with the standard XAF modules have already been translated.
Apply the Untranslated non-calculated filter via the Filters action.
This filter selects the properties that have non-empty default language values with Is Translated unchecked and Is Calculatedchecked. For instance, the OwnMembers node’s Caption properties will be displayed and the Columns node’s Caption properties will be hidden.
Translate all the values in the Translated Value column. Pressing the ENTER key moves focus to the next row. If there are several properties with the same Default Language value, the Multiple Values Translation dialog will be invoked. Click Yes, and all these values will be translated at once, and the next value to be translated will be focused.
NoteYou can use the Translate... button to automate the translation. Select one, several or all rows, and click Translate... or press CTRL+T. In the invoked dialog, select the original language (English by default), click Translate and the Microsoft Translator service will translate for you. Of course, an Internet connection is required for this feature. Note that automatic translation is not perfect, and requires review.
If you are not fluent in the target language, you can hire a professional translator. Export the selected rows to a CSV file via the Export |Selected records command, and pass this file to the translator. The translator will edit the values in the Translated Value column using a spreadsheet or a plaintext editor of his/her choice. The Description column content will help him/her see the context. The translated values can be loaded back from the CSV file via the Import Action. If non-latin characters are used in the CSV file, the file encoding should be UTF-8.
When you have finished the translation, click Save or press CTRL+S to save changes to the Application Model. The translated properties will be hidden due to the Untranslated... filter, and the Is Translated checkbox is checked after saving.
Next, apply the Calculated filter to review the calculated values.
- After closing the Localization window, you can see the localized values in the Model Editor. Save the changes in the Model Editor.
A typical XAF application has platform-specific versions of the authentication, security strategy and modules. For instance, Windows Forms and ASP.NET applications can have SchedulerWindowsFormsModule and SchedulerAspNetModule modules included respectively. These modules extend the Application Model with localizable properties that are not available at the module level. You can have platform-specific Controllers provide strings that need to be localized (action captions, tooltips, exceptions, etc.). So, you should repeat these steps for each platform-specific module.
Localize an XAF Application Directly in the Model Editor
Localizing an XAF application directly in the Model Editor is an alternate approach.
- Select the target language via the XAF Model Editor Toolbar.
- Set the localized values to the properties of the Application root node.
- Expand the ActionDesign | Actions node. Set the localized values to the Caption properties of all its child nodes. The ShortCaptionand the Tooltip properties will be localized automatically, as they expose values from the Caption properties by default. Localize theConfirmationMessage properties if required.
If you do not use the Active Directory authentication, take special note of the Log On window (web page) UI elements' localization. The Log On andCancel buttons are Actions. These Actions have Logon and DialogCancel IDs, and are localizable under the ActionDesign | Actions node.
- Expand the ActionDesign | DisableReasons node. Set localized values to the Caption properties of its child nodes.
- Expand the BOModel node. Set localized values to the Caption properties of its child nodes. You can skip nodes of classes that are not represented in the application UI (e.g., the XPBaseObject node). Note that the localization of ObjectCaptionFormat properties may also be required. The Caption properties of CreatableItems, NavigationItems and Views child nodes will be localized automatically as they expose values from class captions by default.
- Expand the Localization node. Set localized values to the Value properties of its child nodes. Take special note of the Exceptions |UserVisibleExceptions child node. You can skip the Exceptions | SystemExceptions node, as it contains exceptions addressed to developers and administrators, and is invisible to end-users in normal application operation.
- Expand the NavigationItems node. Check to see if there are any child nodes with captions not localized automatically. The Defaultnode caption should be localized.
- If the ValidationModule module is used in the application, expand the Validation node. Set localized values to the child node properties denoted by the globe glyph (
).
- A typical XAF application has platform-specific versions of the authentication, security strategy and modules. For instance, Windows Forms and ASP.NET applications can have SchedulerWindowsFormsModule and SchedulerAspNetModule modules included, respectively. These modules extend the Application Model with localizable properties that are not available at the module level. You can have platform-specific Controllers that provide strings that need to be localized (action captions, tooltips, exceptions, etc.), so repeat these steps for each platform-specific module.
- If you do not use the Active Directory authentication type, localization of the Log On window (web page) requires special attention. This window (web page) content is represented by the AuthenticationStandardLogonParameters Detail View, so navigate to theViews | AuthenticationStandardLogonParameters_DetailView node and set the localized value to its Caption property. Expand the Items child node and localize the Text property of the LogonText node. Localize the UserName and Passwords node captions.
This step should be performed separately for Windows Forms and ASP.NET applications. Use the Model Editor invoked for each application project to localize the Log On window (web page) UI elements. However, the "Log On" and "Cancel" Actions captions can be localized in the module project Model. See the step 5 note for details. The message displayed when the logon fails is also localized in the module project Model under theLocalization | Exceptions | UserVisibleExceptions | Security node.
- There are additional Localization child nodes in the Model Editor, invoked for the application project (Windows Forms or ASP.NET). For instance, in the Windows Forms application Model, you should set localized values to Confirmations, DialogButtons andFrameTemplates child nodes.
Miscellaneous Localizations that Cannot be Performed at Design Time
- The splash screen form displayed on the Windows Forms application startup contains the "Loading" text label. This default text is hardcoded in XAF sources, as the Application Model is not yet initialized when the splash is displayed (see Windows Forms Application Creation and Initialization). You can set a different text using the ISplash.SetDisplayText method.
C#VB
static void Main() {
// ...
MySolutionWindowsFormsApplication winApplication =
new MySolutionWindowsFormsApplication();
// ...
try {
winApplication.SplashScreen.SetDisplayText("Custom Text");
winApplication.Setup();
winApplication.Start();
// ...
XAF应用开发教程(八) 汉化与多国语言支持的更多相关文章
- PowerDesigner V16.5 安装教程以及汉化(数据库建模)
一.power designer是什么以及是干什么的? power designer是能进行数据库设计的强大的软件,是一款开发人员常用的数据库建模工具.分别从概念数据模型(Conceptual Dat ...
- WebStorm 2019 3.3 安装及破解教程附汉化教程
WebStorm2019 3.3 安装及破解教程附加汉化教程 安装包及破解补丁 链接: https://pan.baidu.com/s/19ATTAW3Tsm0huIJSqYChTw 提取码:1ei7 ...
- XAF应用开发教程(五)验证模块
数据验证是应用程序开发中使用频率最高的功能模块,本节详细介绍一下XAF中如何使用验证模块. XAF 验证模块内置了下面的一些验证规则: 验证规则类型 说明 RuleCombinationOfPrope ...
- XAF应用开发教程(四)应用程序模型
XAF是重量型框架,确实够重量的,方方面面都做得规规矩矩. 如果看了前面三节,可能会认为,这N多的Attribute到底都是从哪里来的?到底有多少这样的Attribute?如果不够用了怎么办?等着官方 ...
- phpstorm10.0.3破解版安装教程及汉化方法
phpstorm是一个轻量级且便捷的PHP IDE,其旨在提供用户效率,可深刻理解用户的编码,提供智能代码补全,快速导航以及即时错误检查.不但是php开发的利器,前端开发也是毫不逊色的.下面记录php ...
- XAF应用开发教程-内置Attribute功能列表
在 XAF 框架,一些用来生成一个业务应用程序的信息是在Attribute中指定.您可以将属性应用到业务类 (或它的成员) 指定验证规则,指定如何对数据进行显示. 设置关系类等.本主题提供了有关在何处 ...
- MyEclipse 8.5 开发环境配置,汉化,Aptana2.0插件,SVN 插件,Flex Builder 3/4 插件安装(转载)
转载地址http://elf8848.iteye.com/blog/630864 下载MyEclipse 8.5 可以通过代理http://www.proxyie.cn/访问MyEclipse的官方网 ...
- Androidstudio2.0.0汉化教程及汉化包。
()Eric为大家带来Androidstudio2.0.0的简单汉化教程,许多小伙伴喜欢使用中文版的AS那么没有中文的AS只能靠自己汉化取得更好的体验. 第一步下载AS2.0.0汉化包,我有链接给大家 ...
- Java 安装教程(Eclipse) + 汉化 + 简单创建java项目
Java 安装教程(Eclipse) 要安装Java 要分两个步骤: 1.JDK的安装 2.Eclipse的安装 3.Eclipse汉化 4.Eclipse创建简单java项目 1和2的顺序不能颠倒, ...
随机推荐
- Empire C:Basic 4
一.变量名 1.名字由字母和数字组成,但其第一个字符必须为字母. 2.变量名不要以下划线开头. 3.变量名使用小写字母,符号常量名全部使用大写字母. 二.数据类型及长度 1.char 字符型 占用一个 ...
- Ceph与OpenStack的Nova相结合
https://ervikrant06.wordpress.com/2015/10/24/how-to-configure-ceph-as-nova-compute-backend/ 在Ceph的ad ...
- Java虚拟机学习记录
一.java平台无关性的基础 1.和各个平台有关的虚拟机: 2.和各个平台无关的中间语言(class文件). 二.虚拟机语言无关性的基础 1.class文件 三.java虚机机器中java程序的生命周 ...
- 关于int,long,long long
偶然的,我同学给我发了一个面试题:long 占多少字节 对于这个问题我也不好多说,有时候可能会想的比较多,这个题也需要多想一下 <1>在16位机器上,int 2字节, long 4字节, ...
- asp.net mvc 控制器中操作方法重载问题 解决
Controllers: public ActionResult Index() { return View(db.GuestBooks.ToList()); } // // GET: /Guest2 ...
- Linux modules install
安装模块的时候出现错误:modprobe: chdir(3.0.35-g6774ed9-dirty): No such file or directory. 内核模块没有安装正确.本文记录解决方法. ...
- Spring mvc 下Ajax获取JSON对象问题 406错误
我在学习springmvc过程中(我的项目是配置的后缀是.html),从controller返回对象. 如果我不使用 mvc-annotation-driver,而是手动配置,AnnotationMe ...
- Vue 双层嵌套
这种的需要双层嵌套. 代码: <table id="ict-table" class="ict-table ict-report-table blue-theme& ...
- MVC强类型视图、强类型HTML辅助方法
强类型视图: <table> <tr> <td>ID:</td><td><%: Model.Id %></td> & ...
- Cursor use
Ref:http://www.cnblogs.com/Gavinzhao/archive/2010/07/14/1777644.html declare @Id varchar(100),@name ...