XPage本地化过程:如何批量转换属性文件? [英] XPage Localization Process: How to translate properties files in bulk?

查看:71
本文介绍了XPage本地化过程:如何批量转换属性文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个庞大的项目,拥有100多个自定义控件和XPages,现在我们打算以多种语言提供该项目.

We have a huge project with more than 100 Custom Controls and XPages in place and now we intend to provide the project in multiple languages.

XPages中的本地化提供了一种精美而非常简单的方法,可以通过属性文件以另一种语言转换整个项目.但是,在我们的案例中,许多自定义控件都是其他控件的复本,并且许多翻译/关键字都是相同的,因此一次又一次地更改同一事物变得多余.

Localization in XPages, provides this beautiful and a very simple way to convert the entire project in the other language via the properties file. However, in our case, many custom controls are kind of carbon copies of others and many of the translations/keywords are the same, it becomes kind of redundant to change the same thing again and again.

问题是,有没有一种更简单的方法,在这里我们可以一起进行大量翻译?在什么地方,我们可以将整个翻译导出为一个文件,然后将其重新导入?

So the question is, is there a simpler approach, where we can probably do a bulk of translation together? Something, where we can export the entire translation as one file and import it back?

在正确方向上的任何建议/帮助将不胜感激.

Any suggestion/help in the right direction would really be appreciated.

推荐答案

不要使用XPage的内置本地化. XPages进行了很多更改后,它可能适用于第一次翻译,但是很难维护.

Don't use XPage's build-in localization. It might work for a first translation but it's very difficult to maintain after (a lot of) changes in XPages.

请改用托管Java Bean.
它管理自己的属性文件并实现Map界面.

Use a managed Java bean instead.
It manages own property files and implements Map interface.

您通常会使用Bean与EL一起获得字符串.

You'd use the bean to get a string usually with EL.

示例:
使用str['name']获取名称标签,以便在属性文件中进行以下输入

Example:
Get name's label with str['name'] for following entry in property file

name=Name

对数据使用java.text.MessageFormat进行消息.
在bean中创建类似getMessage(String name, Object arg1)的方法.

Use java.text.MessageFormat for messages with data.
Create a method like getMessage(String name, Object arg1) in your bean.

示例:
使用
获取JavaScript中缺少视图的消息 str.getMessage('message.view.not.found', viewName)用于在属性文件中进行以下输入

Example:
Get the message for a missing view in JavaScript with
str.getMessage('message.view.not.found', viewName) for following entry in property file

message.view.not.found=Could not find view {0}

这篇关于XPage本地化过程:如何批量转换属性文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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