Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: (resolved)Internationalize in Spring plugin portlet
Hi,
I want to translate the following dash words into "words", like the one in language-ext.properties written for Struts protlet.
I have tried to put a language-ext.properties file under WEB-INF/ directory, but there is no translation happening. I am still seeing the dash keywords in webpage.
Thsi is a spring portlet.
Can anyone please tell me how to resove this problem in Spring?
Thanks
Sam
I want to translate the following dash words into "words", like the one in language-ext.properties written for Struts protlet.
<b><liferay-ui:message key="login-details" /></b>
<liferay-ui:message key="mpp-username" />
<input name="userName" type="text" size="25" style="width: 200px;" value="${companyDetails.userName}">
I have tried to put a language-ext.properties file under WEB-INF/ directory, but there is no translation happening. I am still seeing the dash keywords in webpage.
Thsi is a spring portlet.
Can anyone please tell me how to resove this problem in Spring?
Thanks
Sam
In your name-portlet.xml spring context you can define something like this :
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="com/project/locale/message" />
</bean>
And in you com/project/locale/ folder you can have a message_fr.properties, message_en.properties, etc.
Another thing, in your jsp : it's not <liferay-ui:message key="mpp-username" /> anymore but
<spring:message code="mpp-username" />
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="com/project/locale/message" />
</bean>
And in you com/project/locale/ folder you can have a message_fr.properties, message_en.properties, etc.
Another thing, in your jsp : it's not <liferay-ui:message key="mpp-username" /> anymore but
<spring:message code="mpp-username" />
Julien Deruere:
In your name-portlet.xml spring context you can define something like this :
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="com/project/locale/message" />
</bean>
And in you com/project/locale/ folder you can have a message_fr.properties, message_en.properties, etc.
Another thing, in your jsp : it's not <liferay-ui:message key="mpp-username" /> anymore but
<spring:message code="mpp-username" />
I thought this is very simple, but I am getting the following error:
01:55:33,369 WARN [ResourceBundleMessageSource:219] ResourceBundle [au.com.xyz.messages] not found for MessageSource: Can't find bundle for base name au.com.xyz.messages, locale en_US
01:55:33,369 ERROR [MessageTag:80] No message found under code 'login-details' for locale 'en_US'.
javax.servlet.jsp.JspTagException: No message found under code 'login-details' for locale 'en_US'.
at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:183)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)
at org.apache.jsp.jsp.wizUserProfile_jsp._jspx_meth_spring_005fmessage_005f0(wizUserProfile_jsp.java:654)
at org.apache.jsp.jsp.wizUserProfile_jsp._jspService(wizUserProfile_jsp.java:437)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
Thanks
Sam
Where did you put your message_en_US.properties and can I see your configuration in your name-portlet.xml?
Julien Deruere:
Where did you put your message_en_US.properties and can I see your configuration in your name-portlet.xml?
I have fixed the error. The problem was because the path.filenameis different to the filename.properties file.
Thank you Julien.
Sam.
Sam Wan:
Hi,
I want to translate the following dash words into "words", like the one in language-ext.properties written for Struts protlet.<b><liferay-ui:message key="login-details" /></b> <liferay-ui:message key="mpp-username" /> <input name="userName" type="text" size="25" style="width: 200px;" value="${companyDetails.userName}">
I have tried to put a language-ext.properties file under WEB-INF/ directory, but there is no translation happening. I am still seeing the dash keywords in webpage.
Thsi is a spring portlet.
Can anyone please tell me how to resove this problem in Spring?
Thanks
Sam
Thank you very much for the suggestion.
That works well.
Thanks again.
Sam
Hi All,I want to use spring message tag instead of liferay ui message tag. I want to read the global keys such as control panel but its throwing " No message found under code 'control-panel' for locale 'en_US' ".
Do we need to add anything in messagesource in portlet-application-context.xml.
Thanks in Advance.
Regards,
Aravinth
<spring:message code="control-panel" />
Do we need to add anything in messagesource in portlet-application-context.xml.
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>????</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8" />
</bean>
Thanks in Advance.
Regards,
Aravinth
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™