Localize the Hyperic HQU Plugin

HQU supports the I18N internationalization model. The scaffolding tool creates a PropertyResourceBundle file for localization strings properties, plugin_name_i18n.properties in /ui_plugins/{plugin/etc.

Contents of the I18n Properties as Created

Upon creation plugin_name_i18n.properties contains two key-value pairs.
plugin_name.description=[new plugin] plugin_name
Congrats=Congratulations
The first line defines the link name for plugins attached to the portal, where:

  • plugin_name is the name you assigned to the plugin when running the scaffolding task.

  • new plugin is an arbitrary string that will be prefixed to plugin_name

The menu item the is created is:
new plugin plugin_name
The second line defines the string to present in Views for the text item whose key is Congrats.

Understanding How Plugin Views Obtain Localization Strings

A special variable in the .gsp rendered for an action allows it to obtain localized resource bundles from etc/myplugin_i18n.properties. The variable, a lower-case letter 'l', is of the type 'BundleMapFacade' which provides a map-like facade, allowing you to access resource bundle attributes like regular Map entries. For example, in a line from a .gsp, in either of these forms:

${l.Congrats} 
$l['Congrats'] 

The variable l.Congrats points at etc/myplugin_i18n.properties:Congrats
For information about how a plugin controller can obtain localized resource bundles, see Obtaining Localized Strings.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值