Page 1 of 1

Get Current Language in JavaCode

Posted: Mon Nov 24, 2014 12:22 pm
by mrmasoud
Hi,

How can I get current Language in Java Source Code of openKM?

I am trying

Code: Select all

Locale locale = pageContext.getRequest().getLocale();
String lang = locale.getLanguage() + "-" + locale.getCountry() + "(" +locale.getDisplayLanguage() + ")";
but this code always shows "en-US(English)"

Re: Get Current Language in JavaCode

Posted: Tue Nov 25, 2014 6:28 pm
by jllort
UI Language is stored on session, do it

Code: Select all

request.getSession().getAttribute("lang");
The Language is saved into LanguageServlet.java what is called just before the UI starting.

Re: Get Current Language in JavaCode

Posted: Wed Nov 26, 2014 2:34 pm
by mrmasoud
Hi,
jllort Thanks, It's works:)