cancel
Showing results for 
Search instead for 
Did you mean: 

how to get user language in property renderer without web dynpro (java)

Former Member
0 Kudos

Hi all,

how can I get the language of the current user?

Normally I got it with:

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);

IResourceContext resourceContext = new ResourceContext(ep5User);

String strUserLanguage = resourceContext.getLocale().getLanguage();

But this only works in web dynpro applications. Now I need to get the language in my own property renderer. The code throws:

com.sap.tc.webdynpro.services.sal.um.api.WDUMException: No client user defined for the current request (no regular Web Dynpro request as ITask is null.

Thanks a lot

Steffi

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

If you are in a property renderer you always have a IResource which inturn has a ResourceContext and ResourceContext has the Users object.

So the code should be:

IResourceContext resourceContext = IResource.getContext();

IUser user = resourceContext.getUser();

user.getLocale().getLanguage();

Regards,

Praveen Gudapati

Edited by: Praveen Gudapati on May 16, 2008 2:54 PM

Former Member
0 Kudos

Hey Praveen,

sometimes I'm as thick as two short planks...

Thank you so much!

Steffi

Answers (0)