on 11-10-2010 10:44 AM
Hi,
I would like to know which language use the user.
How can I get this?
I want to implement it in 'umLogonPage.jsp'.
I would like to put out some language dependent pictures to the login page.
Something like this (in JAVA):
<%
java.util.Locale locale = (Locale)session.getAttribute("locale");
if (locale.getLanguage().equals("en"))
{
%>
img src="<%=webpath%>layout/EN/login_pic.jpg" border="0" align="top"
<%
}
else if (locale.getLanguage().equals("sk"))
{
%>
<img src="<%=webpath%>layout/SK/login_pic.jpg" border="0" align="top"
<%
}
thanks,
bejglee
Thank you very much everybody!
I'm going to use these recommendations!
I created a temporary solution:
- I picked up two property:
// languages_en.properties
LANG=en
IMG_MSG=Go to page...
// languages_sk.properties
LANG=sk
IMG_MSG=Prejs na str\u00E1nku...
in the 'umLogonPage.jsp':
<%
String lang_dir = "";
String img_msg = "";
try
{
lang_dir = logonLocale.get("LANG");
img_msg = logonLocale.get("IMG_MSG");
}
catch (Exception e)
{
lang_dir = "en";
img_msg = "Go to page'...";
}
%>
...
<!-- html code
<a target="_blank" href="http://{URL}"
img src="<%=webpath%>layout/images/<%=lang_dir%>/img.jpg" alt="<%=img_msg%>" border="0" align="center"></a>
-->
thanks,
bejglee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can extract language from ume by using below code -
String language = umUser.getAttribute("com.sap.security.core.usermanagement", "Language") where umUser is IUser object
You can extract language from local by below code -
language = request.getParameter("ume.logon.locale")
Even you can extract language from cookie.
Cheers,
Sen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi,
> I would like to know which language use the user.
> How can I get this?
> I want to implement it in 'umLogonPage.jsp'.
> I would like to put out some language dependent pictures to the login page.
> Something like this (in JAVA):
>
> <% > java.util.Locale locale = (Locale)session.getAttribute("locale"); > if (locale.getLanguage().equals("en")) > { > %> > img src="<%=webpath%>layout/EN/login_pic.jpg" border="0" align="top" > <% > } > else if (locale.getLanguage().equals("sk")) > { > %> > <img src="<%=webpath%>layout/SK/login_pic.jpg" border="0" align="top" > <% > } >
> thanks,
> bejglee
Hi bejglee,
You can simply use IPortalComponentRequest's method getLocale to get the current language of the user:
[http://help.sap.com/javadocs/NW04/current/ep/com/sapportals/portal/prt/component/IPortalComponentRequest.html#getLocale()|http://help.sap.com/javadocs/NW04/current/ep/com/sapportals/portal/prt/component/IPortalComponentRequest.html#getLocale()]
If you are in JSP code, you can access this object like this:
<% Locale locale = componentRequest.getLocale(); %>
"componentRequest" is an implicit object and therefore always available.
This works for both named users (the locale is determined from UME) and anonymous users (the locale is determined from browser).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.