2017-08-29 70 views
0

我寫了一個maven模塊,其中包含我的liferay自定義佈局。佈局工作正常,但我也希望它的名字被翻譯成幾種語言。 這裏是我的Liferay佈局-templates.xml文件:Liferay:本地化佈局模板名稱

<?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)和值以我的鉤子模塊,但它沒」工作。

回答

0

起初我傾向於聲明沒有內置的佈局模板本地化方法。不過,我擡頭一看JSP的問題(在Liferay的html/portlet/layouts_admin/layout/layout_templates_list.jsp),並發現以下行(縮短和編輯):

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

因此,它看起來像你需要使用翻譯本地化鍵您的佈局模板名稱需要以「layout-template-」開頭,後面跟着佈局模板的名稱,例如給你從你的問題的XML:layout-template-myLayout=My first localized layout template