【问题标题】:Liferay: localize layout template namesLiferay:本地化布局模板名称
【发布时间】:2017-08-29 06:56:10
【问题描述】:

我编写了一个 maven 模块,其中包含我的 liferay 自定义布局。布局工作正常,但我也希望将其名称翻译成几种语言。 这是我的 liferay-layout-templates.xml 文件:

<?xml version="1.0"?>
<!DOCTYPE layout-templates PUBLIC "-//Liferay//DTD Layout Templates 6.2.0//EN" "http://www.liferay.com/dtd/liferay-layout-templates_6_2_0.dtd">

<layout-templates>
<custom>
    <layout-template id="2_columns_layout-75_25" name="myLayout">
        <template-path>/2_columns_layout-75_25/2_columns_75_25.tpl</template-path>
        <wap-template-path>/2_columns_layout-75_25/2_columns_75_25.wap.tpl</wap-template-path>
        <thumbnail-path>/2_columns_layout-75_25/2_columns_75_25.png</thumbnail-path>
    </layout-template> 
</custom>
</layout-templates>

我尝试删除 name 属性并将语言键(与我的模板 id 相同)和值添加到我的钩子模块,但它不起作用。

【问题讨论】:

    标签: liferay hook liferay-6 resourcebundle liferay-6.2


    【解决方案1】:

    起初我倾向于声明没有内置的方法来本地化布局模板。但是,我查看了有问题的 JSP(在 Liferay 的 html/portlet/layouts_admin/layout/layout_templates_list.jsp 中)并找到了以下行(已缩短和编辑):

    <%= HtmlUtil.escape(LanguageUtil.get(locale, 
        "layout-template-" + layoutTemplateName, layoutTemplateName)) %>
    

    所以看起来您需要用于翻译布局模板名称的本地化键需要以“布局模板”开头,后跟布局模板自己的名称,例如给定您问题中的 xml:layout-template-myLayout=My first localized layout template

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-03
      • 1970-01-01
      相关资源
      最近更新 更多