Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Suresh Kumar
themeDisplay.getLocale()
2. April 2013 09:15
Antwort

Suresh Kumar

Rang: Junior Member

Nachrichten: 41

Eintrittsdatum: 9. Mai 2012

Neue Beiträge

Hi,

Bsed on the locale (language), I need to perform some logic. I am getting en_US for <%=themeDisplay.getLocale();%> in my JSP. But I am not able to execute the below conditions. Please help

<%
if(themeDisplay.getLocale().equals("en_US"))
{
%>

-------some JSP code--------

<%
else if(themeDisplay.getLocale().equals("ar_SA"))
%>

-------some JSP code--------


<% } %>



Thanks,
Suresh
David H Nebinger
RE: themeDisplay.getLocale()
2. April 2013 10:47
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 11046

Eintrittsdatum: 1. September 2006

Neue Beiträge

getLocale() returns a Locale class instance, not a string. You'd have to extract the appropriate locale string to do the comparison.
Suresh Kumar
RE: themeDisplay.getLocale()
2. April 2013 22:53
Antwort

Suresh Kumar

Rang: Junior Member

Nachrichten: 41

Eintrittsdatum: 9. Mai 2012

Neue Beiträge

David H Nebinger:
getLocale() returns a Locale class instance, not a string. You'd have to extract the appropriate locale string to do the comparison.


Hi David,

Thanks for the reply.

Could you please enlighten me on how to do this in JSP.

Thanks,
Suresh
Suresh Kumar
RE: themeDisplay.getLocale()
3. April 2013 02:37
Antwort

Suresh Kumar

Rang: Junior Member

Nachrichten: 41

Eintrittsdatum: 9. Mai 2012

Neue Beiträge

David H Nebinger:
getLocale() returns a Locale class instance, not a string. You'd have to extract the appropriate locale string to do the comparison.


Thanks David,

Problem solved.

Here is the solution..

<%
String localelanguage = themeDisplay.getLocale().toString();
if(localelanguage.equalsIgnoreCase("en_US"))
{
%>


Thanks,
Suresh