Get Current Language in JavaCode

Help us to spread the OpenKM word translating the applicacion to your preferrd language.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
mrmasoud
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: Mon Nov 24, 2014 12:04 pm

Get Current Language in JavaCode

Post by mrmasoud » Mon Nov 24, 2014 12:22 pm

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)"

jllort
Moderator
Moderator
Posts: 9124
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Get Current Language in JavaCode

Post by jllort » Tue Nov 25, 2014 6:28 pm

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.

mrmasoud
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: Mon Nov 24, 2014 12:04 pm

Re: Get Current Language in JavaCode

Post by mrmasoud » Wed Nov 26, 2014 2:34 pm

Hi,
jllort Thanks, It's works:)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest