Liferay中的Language.properties文件 [英] Language.properties file in Liferay

查看:164
本文介绍了Liferay中的Language.properties文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的portlet应用程序支持多种语言.所以我:

I want to support multiple languages for my portlet application. So I:

  1. src文件夹中创建了content程序包.
  2. 使用字符串Book-Name=Book Name
  3. 创建的Language.properties文件
  4. 粘贴此行

  1. Created content package in src folder.
  2. Created Language.properties file with string Book-Name=Book Name
  3. Paste this line

 <supported-locale>es</supported-locale> 
 <resource-bundle>content/Language</resource-bundle>

portlet.xml文件中.


所以你能告诉我为什么我这里还有Book-Name吗?!


So could you please tell me why I still have Book-Name here?!

<liferay-ui:search-container>
<liferay-ui:search-container-results results="${bookListArray}" />
        <liferay-ui:search-container-row className="com.softwerke.model.Book" modelVar="aBook">
        <liferay-ui:search-container-column-text property="bookName" name="Book-Name"/>
        <liferay-ui:search-container-column-text property="bookDescription" name="Description"/>
        <liferay-ui:search-container-column-jsp path="/html/action.jsp" align="right" />
     </liferay-ui:search-container-row>
     <liferay-ui:search-iterator />
</liferay-ui:search-container>

更新

此:

    <liferay-ui:search-container-column-text property="bookName" name="${bookName}" />

....

   <c:set var="bookName"> <liferay-ui:message key="book-Name" /> </c:set> 

没有 也可以工作

does NOT work too

推荐答案

您根本没有使用它. 此行中的name="Book-Name"

You are not using it at all. The name="Book-Name" in this line

<liferay-ui:search-container-column-text property="bookName" name="Book-Name"/>

将name属性添加到此html组件中,并在引号内定义valye,以使该值成为在属性文件中定义的值,在这种情况下,必须使用<liferay-ui:message /> tag: :

adds name property to this html component with valye defined inside the quotation marks to make this value the one defined in the properties file you have to use <liferay-ui:message /> tag in your case it would be: :

<liferay-ui:search-container-column-text property="bookName" name="<liferay-ui:message key="Book-Name" />"/>

语言键全为小写也是无关紧要的,但在开发人员的实践中.

Also it is not relevant but a dev practice that the language key is all lower case.

这篇关于Liferay中的Language.properties文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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