[英]Liferay custom portlet localization
I have a task to localize my custom portlet. 我有一个任务来本地化我的自定义portlet。 I'm trying to trick it with hook.
我试图用钩子欺骗它。 I read that I should create hook.xml configuration and property file in my portlet project
我读到我应该在我的Portlet项目中创建hook.xml配置和属性文件
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<language-properties>resources/language.properties</language-properties>
</hook>
Ok. 好。 But how can I use it for my custom portlet with custom field?
但是,如何将其用于带有定制字段的定制Portlet? For example I have jsp:
例如我有jsp:
<c:choose>
<c:when test="${status.equals('captchaError')}">
Captcha error //How can I localize it?
<br />
</c:when>
<c:when test="${status.equals('numberError')}">
Number error //How can I localize it?
<br />
</c:when>
<c:when test="${status.equals('success')}">
Message send //How can I localize it?
<br />
</c:when>
</c:choose>
I hope my question is clear and you will help me! 希望我的问题很清楚,您会帮助我!
Define you messages as key-value pair in language.properties file. 在language.properties文件中将您的消息定义为键值对。
eg number-error= Number Error 例如,数字错误=数字错误
And use liferay-ui:message tag to get message values. 并使用liferay-ui:message标签获取消息值。 You have to declare taglib for liferay-ui tags.
您必须为liferay-ui标签声明taglib。
eg <liferay-ui:message key='number-error'/>
例如
<liferay-ui:message key='number-error'/>
This tag will display value for number-error key from language properties file. 该标签将显示语言属性文件中数字错误键的值。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.