Fórum

RE: How to change language for custom portlet?

thumbnail
Mani kandan, modificado 12 Anos atrás.

How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Hi all,

I have created one custom portlet inside (D:\liferay-portal-6.0.6\tomcat-6.0.29\webapps\ROOT\html\portlet\book\view.jsp). It has the book details.

If I change the language using Language portlet I want to change the language for my custom portlet.

I want change language for arabic language.

My portlet has the following details,


          
		         
		            Book Name
		             Author Name
		             Category Name
			     SubCategory Name
		             Delete
	                  
	


If I change language for this portlet to arabic, then details like Book Name, Author Name etc, should change to arabic language.

any help?
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Are you having any difficulties with the default Liferay's I18N techniques using the language property files?
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
I dont have any idea about that.

I dont know how to do this.

Could you give me any best link to achieve this?
thumbnail
Ravi Kumar Gupta, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
Create a Language.properties, and other properties for the locale you want, for your portlet. And then in jsp use
<liferay-ui:message key="key-to-book-name" />
Now whenever whatever language you will select, it should be converted.
thumbnail
Mayur Patel, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
I tried but no luck. Here i have attached my war.

Pls correct me the error.
thumbnail
Ravi Kumar Gupta, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
use <resource-bundle>content/Language</resource-bundle> in portlet.xml after <supports> </supports> tag

HTH
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Not getting output. could u see the war file once again pls.
thumbnail
Tejas Kanani, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Master Postagens: 654 Data de Entrada: 06/01/09 Postagens Recentes
Hi,

I've checked your war, somehow Language properties files is not getting copied to classes folder.
All three properties files should be inside classes/content folder.

Somehow its not build properly.

Please use attached war. It should work.
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Thanks Tejas,
Its a valuable reply.

But I got the final problem. I am getting undefined language format.

This is my jsp file,

&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;
<portlet:defineobjects />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<liferay-ui:message key="category" /><br>
<liferay-ui:message key="authorname" /><br>
<liferay-ui:message key="bookname" /><br>
<liferay-ui:message key="key-to-book-name" />


See the attachment file..
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Try inserting below in your jsp.

<%@ page contentType="text/html;charset=UTF-8" %>
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
I included
<%@ page contentType="text/html;charset=UTF-8" %>
but no luck.

could you pls check my war file.
thumbnail
Ravi Kumar Gupta, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
i guess you need to change the language.properties file for arabic properly.

Change it using native2ascii command.
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Follow Ravi's advice on converting your properties file to ascii. You'll have to modify Liferay otherwise.
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
I tried my best but i cant do it. Could anyone of you correct my war file and attach it here pls?
thumbnail
Hitoshi Ozawa, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Are you restarting your server after native2ascii your ar_SA properties file? Stop Liferay, delete the temp directory, delete the Language portlet, start Liferay,
deploy Language portlet.
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: document attachment feature

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
You can get here.

Could you create new thread for new post. Already some discussions are going on. Create new one here
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Still I am not able to get the solution. May be I couldn't the native2ascii command properly.

Could you pls how to do native2ascii command?

Pls correct my war file.
thumbnail
Juhi Kumari, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 347 Data de Entrada: 12/12/11 Postagens Recentes
Hi Mani,
You can use this command from command line
native2ascii -encoding utf8 source-file target-file
.
Use your native file as source.

Regards
Juhi
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Hmm well thanks Juhi,

There is no place of native2ascii command. I followed the steps in Liferay_User_Interface_Development book(page no.102).

And got the solution
thumbnail
Mazhar Alam, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Hi mani,

Did you resolved your problem.If yes then do tell me wat u did to resolve it.coz i too have the same problem..

Thanks in advance
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Follow this steps properly,


1. Open Liferay Plugins SDK console.
2. Navigate (cd) to portlets folder.
3. Run the following command to create a sample portlet skeleton:
create palmtree-language-sample "Palm-Tree Multiple Language sample portlet"
4. Navigate (cd) to ${liferay.plugins.sdk}\portlets\palmtree-language-sample-portlet\docroot\WEB-INF folder.
5. Create a file named liferay-hook.xml to support both English and
Brazil Portuguese
<!--?xml version="1.0" encoding="UTF-8"?-->

<hook>
<language-properties>content/Language_en_US.properties</language-properties>
<language-properties>content/Language_pt_BR.properties</language-properties>
</hook>
6. Navigate (cd) to ${liferay.plugins.sdk}\portlets\palmtree-language-sample-portlet\docroot\WEB-INF folder.
7. Run the following command:
mkdir src\content
8. Navigate (cd) to ${liferay.plugins.sdk}\portlets\palmtree-language-sample-portlet\docroot\WEB-INF\src\content folder.
9. Create three language properties files named Language.properties, Language_en_US.properties, and Language_pt_BR.properties.
10. Open Language.properties file and add the following line:
palmtree-language-sample-display-text=This is a sample display text in default English
11. Open Language_en_US.properties file and add the following line:
palmtree-language-sample-display-text=This is a sample display text in English
12. Open Language_pt_BR.properties file and add the following line. Please note that the Portuguese text below is from Google Translator.
palmtree-language-sample-display-text=Este é um texto de exibição de amostra em Português
13. Open ${liferay.plugins.sdk}\portlets\palmtree-language-sample-portlet\docroot\view.jsp and add the following lines:
&lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %&gt;
&lt;%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %&gt;
<portlet:defineobjects />
This is the <b>Palm Tree Multiple Language sample portlets</b> portlet.
<br><br>
<liferay-ui:message key="palmtree-language-sample-display-text" />
14. Navigate (cd) to ${liferay.plugins.sdk}\portlets\palmtree-language-sample-portlet folder.
15. Run command "ant" to build and package the portlet WAR file.
16. Copy the generated palmtree-language-sample-portlet-<version>.war file from ${liferay.plugins.sdk}\dist folder to your Liferay Portal deploy folder.
17. Start your Liferay Portal server.
18. Log in as the Portal Administrator and add the above portlet to your page
</version>
thumbnail
Mazhar Alam, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Hi mani,

I followed your steps and was able to view in the desired language.Thanks..
But when i included -Language_ar_SA in my content and then successfully deployed it after that i checked in my page it's not displaying the correct characters..rather it's displaying some boxes..

regards,
Mazhar
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Try this in your jsp file,
&lt;%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %&gt;

or
Its better to attach here your war file?
thumbnail
Mazhar Alam, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Hi mani,

here is the attached war file.
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Here I have attached the working war file take it.
thumbnail
Mazhar Alam, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Thanks Mani for your help..

Could you please tell me what changes u' ve made in my war to get the proper output.

regards,
mazhar
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Just in replaced the language properties files from liferay source.

It might had some UTF-8 file problem
thumbnail
Mazhar Alam, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Hi mani,

Didn't get you,could you please explain more.

Regards
thumbnail
Mani kandan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 492 Data de Entrada: 15/09/10 Postagens Recentes
Any help?
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
Hi Mani !
I am trying to show Hindi Language....its not working in my custom portlet....i am using LR 6.0.6 with tomcat bundle...
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: How to change language for custom portlet?

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
only key message is appearing not its value...... emoticon