Localization Tool(本地化工具)
The Localization Tool is intended to simplify localizing XAF applications. While you can perform localization directly in the Model Editor, in most cases the Localization Tool is more convenient. This topic provides general information for using this tool. Step-by-step instructions for using the Localization Tool are available in the How to: Localize an XAF Application topic.
本地化工具旨在简化XAF应用程序的本地化过程。虽然您可以直接在模型编辑器中进行本地化,但在大多数情况下,本地化工具更为便捷。本主题提供了使用该工具的基本信息。有关使用本地化工具的分步说明,请参阅“如何:本地化XAF应用程序”主题。
- Invoking the Localization Tool(调用本地化工具)
- Localization Window Elements(本地化窗口元素)
- Filtering(筛选)
- Editing Values(编辑值)
- Microsoft® Translator Service Support(微软翻译服务支持)
- Import/Export Functionality(导入/导出功能)
- Typical Use Cases(典型使用场景)
- Settings Storage(设置存储)
Note
Check to see if the ready-to-use localizations of standard XAF modules and DevExpress controls are available for your language before using the Localization Tool. You can significantly decrease the number of strings to be translated.
在使用本地化工具之前,请先检查是否有适用于您所用语言的标准XAF模块和DevExpress控件的现成本地化内容。这能大幅减少需要翻译的字符串数量。
##Invoking the Localization Tool(调用本地化工具)
The Localization Tool can be accessed via the Localization button on the XAF Model Editor Toolbar. The tool is primarily intended to be used at design time. However, it is also available at runtime so users and application administrators can access its features.
本地化工具可通过XAF模型编辑器工具栏上的“本地化”按钮访问。该工具主要用于设计时,但在运行时也可使用,方便用户和应用程序管理员使用其功能。
The Localization button is inactive when there are no translation languages added. You should add one or more languages, as described in the Localization Basics topic, in order to use the Localization tool.
当未添加翻译语言时,“本地化”按钮处于非激活状态。要使用本地化工具,需按照“本地化基础”主题中的说明添加一种或多种语言。
Localization Window Elements(本地化窗口元素)
Grid(网格)
The Localization window provides a grid editor, containing the following columns.
本地化窗口提供了一个网格编辑器,包含以下列。
You can use common XtraGrid features - search and sort values, reorder, hide and show columns, apply grouping and filters.
您可以使用XtraGrid的常见功能——搜索和排序值、重新排序列、隐藏和显示列、应用分组和筛选。
The Default Language Value and Translated Value columns are editable inline. You can select multiple rows, when required. The CTRL+A shortcut selects all rows that are visible due to current filtering.
“默认语言值”和“翻译后的值”列支持 inline 编辑。必要时,您可以选择多行。CTRL+A快捷键可选择当前筛选条件下所有可见的行。
Toolbar(工具栏)
The localization window has the toolbar.
本地化窗口有一个工具栏。
The commands available on the toolbar are described in the table below.
工具栏上可用的命令如下表所述。
The Export…, Import… and Translate… commands are also available in the grid context menus.
“导出…”、“导入…”和“翻译…”命令也可在网格的上下文菜单中找到。
Filtering(筛选)
The localizable properties in the grid can be filtered to suit the current demands. You can use the XtraGrid filtering capabilities, but its more convenient to use the Filter dropdown.
网格中的可本地化属性可以根据当前需求进行筛选。您可以使用XtraGrid的筛选功能,但使用“筛选”下拉列表更为便捷。
The following predefined filters are supplied.
提供了以下预定义筛选器。
You can use the custom filter to exclude certain nodes from your “to be translated list”. For instance, you can skip the SystemExceptions node, as it contains exceptions addressed to developers and administrators, and invisible to end-users in normal application operation. The following image illustrates the corresponding customized filter based on the predefined Untranslated non-calculated filter.
您可以使用自定义筛选器从“待翻译列表”中排除某些节点。例如,您可以跳过SystemExceptions节点,因为它包含面向开发者和管理员的异常信息,在应用程序正常运行时对最终用户不可见。下图展示了基于预定义的“未翻译的非计算值”筛选器的相应自定义筛选器。
Editing Values(编辑值)
The Default Language Value and Translated Value columns are editable inline. So, you can easily perform manual translation cell by cell, just like in a spreadsheet editor. Additionally, you can perform modifications of default language values when required. Values that do not fit the cell width are displayed multiline.
“默认语言值”和“翻译后的值”列支持inline编辑。因此,您可以像在电子表格编辑器中一样,轻松地逐单元格进行手动翻译。此外,您可以在需要时修改默认语言值。不适合单元格宽度的值将以多行显示。
If you edit a value and press ENTER, the value below is focused automatically. If the translated value occurs several times, the following dialog is invoked.
如果您编辑一个值并按Enter键,下方的值将自动获得焦点。如果翻译后的值出现多次,将弹出以下对话框。
If you choose Yes, all the similar values will be automatically replaced with your translation. You can check “Use always” to remember your choice and suppress this dialog until the next use of the Localization tool. The Save action passes changes to the Model Editor. Note that the Is Translated state is not updated immediately after translating a value. It changes only after executing the Save action. This behavior is implemented to avoid hiding the just translated value by the Translated filter.
如果您选择“是”,所有相似的值都将自动替换为您的翻译。您可以勾选“始终使用”以记住您的选择,并在下次使用本地化工具前不再显示此对话框。“保存”操作会将更改传递到模型编辑器。请注意,翻译值后,“是否已翻译”状态不会立即更新,仅在执行“保存”操作后才会更改。这种行为是为了避免“已翻译”筛选器隐藏刚刚翻译的值。
The modified records are displayed in bold, as in the Model Editor’s property grid.
已修改的记录将以粗体显示,如同在模型编辑器的属性网格中一样。
Microsoft® Translator Service Support(微软翻译服务支持)
The Translate… command is designed to perform an automatic translation of the selected values via the Microsoft® Translator service. This is a free online translation service provided by Microsoft. You can access its web front-end at https://www.bing.com/search?q=Bing+translate. The Translate… action allows you to get the benefit of this service without leaving the Localization window. This action invokes the following dialog.
“翻译…”命令旨在通过微软翻译服务对选定值进行自动翻译。这是微软提供的免费在线翻译服务。您可以通过https://www.bing.com/search?q=Bing+translate访问其网页前端。“翻译…”操作让您无需离开本地化窗口即可使用该服务。此操作会调用以下对话框。
If the default language is not English, you can select one of the supported source languages. Then click Translate, and the selected default language values will be passed to the Microsoft Translator service. The translated values are modified with the results from the service. If the translation is time-consuming, the progress bar will be displayed. Of course, an active Internet connection is required. However, the automatic translation is not perfect and typically requires manual review.
如果默认语言不是英语,您可以选择一种受支持的源语言。然后单击“翻译”,选定的默认语言值将被传递到微软翻译服务。翻译后的值将根据服务返回的结果进行修改。如果翻译耗时较长,将显示进度条。当然,这需要活跃的互联网连接。但自动翻译并非完美,通常需要人工审核。
Note
If you run the Localization Tool from the standalone Model Editor, and you are connecting to the Internet through a proxy server, it is recommended that you add the following setting to the Model Editor’s configuration file.
如果您从独立的模型编辑器运行本地化工具,且通过代理服务器连接互联网,建议您在模型编辑器的配置文件中添加以下设置。
xml
<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
...
This file is located in the same folder as the Model Editor executable (%PROGRAMFILES%\DevExpress 24.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v24.1.exe).
该文件位于模型编辑器可执行文件所在的文件夹中(%PROGRAMFILES%\DevExpress 24.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v24.1.exe)。
The Microsoft® Translator limits the amount of text you can translate in a given time period. If you need to translate a large number of strings, consider implementing a custom translation provider as described in the following article: How to: Create a Custom Translation Provider for the Localization Tool. Your custom translation provider can use an alternative translation method, such as Google Translate or a local dictionary.
微软翻译服务对特定时间段内可翻译的文本量有限制。如果您需要翻译大量字符串,请考虑按照以下文章中的说明实现自定义翻译提供程序:“如何:为本地化工具创建自定义翻译提供程序”。您的自定义翻译提供程序可以使用其他翻译方法,如谷歌翻译或本地词典。
Import/Export Functionality(导入/导出功能)
The Export… command provides you with the ability to export selected, modified or all records to a CSV file.
“导出…”命令允许您将选定的、已修改的或所有记录导出到CSV文件。
The Is Translated and Is Calculated columns are omitted when exporting. The comma character is used as a separator. The output file encoding is UTF-8. Below is a sample of the output file (descriptions are skipped to save space).
导出时会省略“是否已翻译”和“是否为计算值”列。使用逗号作为分隔符。输出文件的编码为UTF-8。以下是输出文件的示例(为节省空间省略了描述)。
*“Property Name”,“en”,“de”,“Node Path”,“Description”
“Title”,“MainDemo - Outlook in 60 minutes!”,“MainDemo - Outlook in 60 Minuten!”,“Application”,“…”
“Subtitle”,“XAF demo application”,“XAF Demo-Anwendung”,“Application”,“…”
“Caption”,“Refresh”,“Aktualisieren”,“ActionDesign\Actions\Refresh”,“…”
“Caption”,“Save”,“Speichern”,“ActionDesign\Actions\Save”,“…”*
“Property Name”,“en”,“de”,“Node Path”,“Description”
“Title”,“MainDemo - Outlook in 60 minutes!”,“MainDemo - Outlook in 60 Minuten!”,“Application”,“…”
“Subtitle”,“XAF demo application”,“XAF Demo-Anwendung”,“Application”,“…”
“Caption”,“Refresh”,“Aktualisieren”,“ActionDesign\Actions\Refresh”,“…”
“Caption”,“Save”,“Speichern”,“ActionDesign\Actions\Save”,“…”
You can pass the CSV file to a professional translator and ask them to edit the values in the Translated Value column using a spreadsheet or plaintext editor of their choice. The Description column text helps to see the context in this instance.
您可以将CSV文件交给专业翻译人员,让他们使用自己选择的电子表格或纯文本编辑器编辑“翻译后的值”列中的值。在这种情况下,“描述”列的文本有助于理解上下文。
The Import… command provides you with the ability to import translations from the CSV file. This command replaces the default and translated values with values found in the specified CSV file. Rows with an invalid node path or property name are skipped. The CSV file encoding should be UTF-8. If the translator saved the CSV file in another encoding, you should convert it to UTF-8 before importing.
“导入…”命令允许您从CSV文件导入翻译。此命令会用指定CSV文件中的值替换默认值和翻译后的值。节点路径或属性名称无效的行将被跳过。CSV文件的编码应为UTF-8。如果翻译人员以其他编码保存了CSV文件,您应在导入前将其转换为UTF-8。
Typical Use Cases(典型使用场景)
-
The developer performs the localization
开发者执行本地化
If you are fluent in the target language, you can translate the localizable values, either manually or with the help of the Microsoft Translator service.
如果您精通目标语言,可以手动翻译可本地化的值,或借助微软翻译服务进行翻译。 -
The developer creates a CSV file for professional translator
开发者为专业翻译人员创建CSV文件
If you have hired a professional translator, you can use the Export… | Selected records command to create a CSV file containing currently selected rows for him. The translated values can be loaded back via the Import command.
如果您聘请了专业翻译人员,可以使用“导出…|选定的记录”命令为其创建包含当前选定行的CSV文件。翻译后的值可通过“导入”命令加载回来。 -
The localization of standard XAF modules and DevExpress controls is reused
重用标准XAF模块和DevExpress控件的本地化内容
The common set of localizable values can be translated once, exported to the CSV files and reused in each new application. This approach can be used if there are no ready-to-use language resources for the target language. Use the Export… | Modified records command to export modified records only.
通用的可本地化值集可以翻译一次,导出到CSV文件中,并在每个新应用程序中重用。如果目标语言没有现成的语言资源,可采用此方法。使用“导出…|已修改的记录”命令仅导出已修改的记录。
Settings Storage(设置存储)
The Localization Tool saves its settings between runs (grid settings, translation language and so on) in the system registry under the HKEY_CURRENT_USER\Software\Developer Express\XAF\Model Editor\Localization key. You can delete this key to reset settings.
本地化工具会在多次运行之间将其设置(网格设置、翻译语言等)保存在系统注册表的HKEY_CURRENT_USER\Software\Developer Express\XAF\Model Editor\Localization项中。您可以删除此项以重置设置。