Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Neetu Mishra
How to change portlet title on the basis of language selected?
July 11, 2012 9:35 PM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

Hi,

I am creating a custom portlet & I want to change portlet title on the basis of language selected by the user. I know how to change the portlet's content but didn't get any solution to change the portlet's title.

Thanks in advance!!


Regards,
Neetu
DarshanKumar N Bhatia
RE: How to change portlet title on the basis of language selected?
July 11, 2012 9:56 PM
Answer

DarshanKumar N Bhatia

Rank: Junior Member

Posts: 85

Join Date: March 2, 2010

Recent Posts

For any kind of portlet (custom /inbuilt one):

To change Title for particular locale :

1) Deploy portlet on page.
2) Click on Look and feel --> Portlet Configuration Tab

Check : Use Custom Title

Provide ur custom title Name and select a language corresponding to it.

Save.

Test it : By Putting langauge Portlet and changing to various locale.
Attachment

Attachments: custom title for custom portlet.png (90.1k)
Dhrutika Vyas
RE: How to change portlet title on the basis of language selected?
July 11, 2012 10:13 PM
Answer

Dhrutika Vyas

Rank: Expert

Posts: 438

Join Date: February 9, 2009

Recent Posts

Hi Nitu,

One solution is as provided in above post if you do it by configuration,
Other way is by changing in xml:

  • Enter Resource bundle path in your portlet.xml.(i.e. <resource-bundle>com.my.langauage.Resource.Navigation.Language</resource-bundle>)
  • On defined path place Language_*.properties files.
  • In these files make respective language entries (i.e.Language_en.properties : javax.portlet.title=Navigation ,Language_es.proeprties=Navegaci\u00F3n)

Regards,
Dhrutika
Neetu Mishra
RE: How to change portlet title on the basis of language selected?
July 12, 2012 9:54 PM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

Thanks Dhrutika & DarshanKumar for your quick replies!!

Hey DarshanKumar, this is also a nice way of doing it. I knew about the custom titles but didn't knew that we can change it on the basis of language as well. So thanks once again.emoticon


For any kind of portlet (custom /inbuilt one):

To change Title for particular locale :

1) Deploy portlet on page.
2) Click on Look and feel --> Portlet Configuration Tab

Check : Use Custom Title

Provide ur custom title Name and select a language corresponding to it.

Save.



Hey Dhrutika I have a question about resource bundle path:
Enter Resource bundle path in your portlet.xml.(i.e. <resource-bundle>com.my.langauage.Resource.Navigation.Language</resource-bundle>)


It might be very simple question but apologize me for that.

Since, I am placing language_*.properties files in docroot/WEB-INF/src/content folder so is it ok to put resource bundle path like this??
1<resource-bundle>content</resource-bundle>


I have tried this but it's not working, so I think I am missing some thing.emoticon Please help me regarding this. Thanks once again!!


Thanks in advance!!
Muzakir Khan
RE: How to change portlet title on the basis of language selected?
July 12, 2012 10:44 PM
Answer

Muzakir Khan

Rank: Regular Member

Posts: 112

Join Date: March 14, 2012

Recent Posts

Neetu Mishra:

Since, I am placing language_*.properties files in docroot/WEB-INF/src/content folder so is it ok to put resource bundle path like this??
1<resource-bundle>content</resource-bundle>


I have tried this but it's not working, so I think I am missing some thing.emoticon Please help me regarding this. Thanks once again!!


Try this,
<resource-bundle>content/language.properties</resource-bundle> emoticon BOL

Regards
Khan
Neetu Mishra
RE: How to change portlet title on the basis of language selected?
July 12, 2012 10:52 PM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

Hi Muzakir,

Thanks for your reply.

Try this,
<resource-bundle>content/language.properties</resource-bundle>


I have tried this but it was flagging a warning in Eclipse that file name should not end with .properties. So I have tried this:
1<resource-bundle>content/language.properties</resource-bundle>

& it's working.emoticon

Thanks once again for your suggestion!!
Akash Jaisawal
RE: How to change portlet title on the basis of language selected?
May 20, 2014 10:12 PM
Answer

Akash Jaisawal

Rank: Regular Member

Posts: 136

Join Date: March 3, 2012

Recent Posts

I have tried this but it was flagging a warning in Eclipse that file name should not end with .properties. So I have tried this:
1<resource-bundle>content/language.properties</resource-bundle>

& it's working.emoticon

Thanks once again for your suggestion!!

Sorry Neetu but i didnt get you point here!
You have tried this "
1<resource-bundle>content/language.properties</resource-bundle>
" but it was flagging a warning in Eclipse that file name should not end with .properties. So You have tried again this:
1<resource-bundle>content/language.properties</resource-bundle>

and it worked?
Akash Jaisawal
RE: How to change portlet title on the basis of language selected?
May 20, 2014 10:34 PM
Answer

Akash Jaisawal

Rank: Regular Member

Posts: 136

Join Date: March 3, 2012

Recent Posts

Or there should be only:
1<resource-bundle>content/language</resource-bundle>
?

Sorry if am wrong somewhere!
Neetu Mishra
RE: How to change portlet title on the basis of language selected?
May 26, 2014 11:28 AM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

Akash Jaisawal:
Or there should be only:
1<resource-bundle>content/language</resource-bundle>
?

Sorry if am wrong somewhere!



Hi Akash,

Thanks for correcting me emoticon

I have tried this:
1<resource-bundle>content/language</resource-bundle>
Akash Jaisawal
RE: How to change portlet title on the basis of language selected?
May 26, 2014 10:00 PM
Answer

Akash Jaisawal

Rank: Regular Member

Posts: 136

Join Date: March 3, 2012

Recent Posts

Neetu Mishra:
Akash Jaisawal:
Or there should be only:
1<resource-bundle>content/language</resource-bundle>
?

Sorry if am wrong somewhere!



Hi Akash,

Thanks for correcting me emoticon

I have tried this:
1<resource-bundle>content/language</resource-bundle>



Hello Neetu,

I ve followed these steps but not succeed to achieve the task!
any other way to change the title programmatically?
Neetu Mishra
RE: How to change portlet title on the basis of language selected?
June 2, 2014 6:09 AM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

hi Akash,

There is no other way to change the title programatically emoticon
Akash Jaisawal
RE: How to change portlet title on the basis of language selected?
June 4, 2014 9:45 PM
Answer

Akash Jaisawal

Rank: Regular Member

Posts: 136

Join Date: March 3, 2012

Recent Posts

Neetu Mishra:
hi Akash,

There is no other way to change the title programatically emoticon



ohh..
I tried all the steps you mentioned bit nothing happns emoticon
Vipin Bardia
RE: How to change portlet title on the basis of language selected?
June 4, 2014 10:47 PM
Answer

Vipin Bardia

Rank: Regular Member

Posts: 157

Join Date: February 27, 2011

Recent Posts

Hi Akash,

This should work -

1renderResponse.setTitle(LanguageUtil.get(renderRequest.getLocale(), "keyname"));

Regards.
Shreyas Kamthe
RE: How to change portlet title on the basis of language selected?
July 16, 2014 5:00 AM
Answer

Shreyas Kamthe

Rank: Junior Member

Posts: 58

Join Date: June 9, 2014

Recent Posts

Hi everybody,

Can anybody tell me how to customize the portlet for a new added language.
I am trying to set the title to the newly added language but the title shows me "????" .
Can anybody suggest me a solution ?
Is this because i have not made an entry in the portlet.xml ?

Please do reply