cancel
Showing results for 
Search instead for 
Did you mean: 

Error while trying to retrevie the Current Portal Language

Former Member
0 Kudos

Dear All,

In my present application,I need to pass the language as a parameter to the backend.As my application needs to support different languages.In this regard I need to capture the current user language and if the user language is not mentioned then it should take the Browser language and even if that is not present it should take the server language.

I am Using XLF Files in Webdynpro for the language change in Appilcation Screen and it is working properly.

The present code which I am using to get the language is:

CODE:

IWDClientUser user = WDClientUser.getLoggedInClientUser();

IUser iuser = user.getSAPUser();

String userid = iuser.getDisplayName();

wdComponentAPI.getMessageManager().reportSuccess("userid"+userid);

iuser.getLocale();

But when i am trying to print it.I am getting an Null value.Can anybody please let me know if i am going the right way and help me in getting the language of the user.

Thanks in Advance

Thanks and Regards,

Nishita Salver

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

you can try this, in my portalenviroment this solution works:


WDClientUser.getCurrentUser().getLocale();

So from locale you can also convert into a string representation or whatever you want to.

kind regards

Fabian

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this code



try {
IUser user = WDClientUser.getCurrentUser().getSAPUser();
wdComponentAPI.getMessageManager().reportSuccess( user.getUniqueName() + " " + user.getLocale().getDisplayLanguage());
} catch (WDUMException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

Regards

Vinod V