Foren

themeDisplay.getLocale()

Suresh Kumar, geändert vor 11 Jahren.

themeDisplay.getLocale()

Junior Member Beiträge: 47 Beitrittsdatum: 09.05.12 Neueste 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
thumbnail
David H Nebinger, geändert vor 11 Jahren.

RE: themeDisplay.getLocale()

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste 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, geändert vor 11 Jahren.

RE: themeDisplay.getLocale()

Junior Member Beiträge: 47 Beitrittsdatum: 09.05.12 Neueste 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, geändert vor 11 Jahren.

RE: themeDisplay.getLocale()

Junior Member Beiträge: 47 Beitrittsdatum: 09.05.12 Neueste 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