cancel
Showing results for 
Search instead for 
Did you mean: 

How to set locale / language dynamically ?

Former Member
0 Kudos

Hi all,

In UME provider setting (configuration of J2EE engine), there exist a parameter ume.logon.locale

When setting it to true, a dropdown is displayed on logon screen, allowing user to choose a language.

Unfortunately, this seems to have no effect on language used for connection in web dynpro.

Indeed, as specified here http://help.sap.com/saphelp_nw04/helpdata/en/f4/d95664da179b4db731e21c2e470b72/frameset.htm , the language of current authenticated user is used, whatever the language preference of IE is.

Do anyone of you use this feature of web dynpro logon screen ?

Is there something more to be configured to tell web dynpro application to use selected language instead of user's language ?

Also, something that I noticed: when passing sap-locale parameter to my application, the language is not anymore changed...

Thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

let's say I want to set the locale dynamically over the wd dispatcher I use:

http://<host>:<port>/webdynpro/dispatcher/local/<wd comp name>/<wd app name>?sap-locale=en
http://<host>:<port>/webdynpro/dispatcher/local/<wd comp name>/<wd app name>?sap-locale=de

The problem here is that this works only before I have a session. Let's say you require users to be authenticated when using the wd app (through sap.authentication=true), then the above setting of the chosen language through the sap-locale GET parameter only works before you're authenticated. Say if I want to test my application above in english and german, I use the first link above, log in, test it in english, log off, use the second link, log in, test in german, log off.

Best regards,

Fabian

Former Member
0 Kudos

I have also tried to translate the applications using XLF but now question is that how can we call these applications when they are associated to iview,page and worksets etc.

I mean to say how we should call the applicatiosn in external facing portal.There teh link comes as navigation url right how can we add additional sap-locale= ar????????

Regards,

Anupama

Former Member
0 Kudos

TWM,

It is not quite obvious what you mean with "dynamic"?

Changing locale of working application on the fly? Starting every application in defined locale (instead of user / browser locale)? For second case sap-locale parameter works perfect, what problems are you experiencing with using it?

VS

Former Member
0 Kudos

Hi Valery,

Sorry for confusion... I meant dynamically as choosing language each time a user get connected, so each time starting the application.

About sap-locale parameter: it seems this parameter has no effect on web dynpro application.

I tried to set language from url like this: http://[servername]:[portnumber]/webdynpro/dispatcher/local/App/App?SAPtestId=0&sap-cssurl=/webdynpr...wddispwda/global/SSR/themes/myThem&sap-locale=fr

Former Member
0 Kudos

TWM,

Then sap-locale is most suitable way, I guess.

Regarding problems, probably not of your resources localized? Try the following simple test:

1. Create application with table control with several rows.

2. Run application with sap-locale=en, sap-locale=de (for me sap-locale=ru works as well

3. You should notice, that text on table scroll buttons (first, prev, next, last) is changed accordingly to locale.

4. Also if it is not change from one browser window, try to run every URL from separate browser instance (i.e. close previous instance, start new one)

VS

Former Member
0 Kudos

Hi Valery,

Thanks for your tips...

I tried to do follow your recommendation, and it's working properly.

Now, what I just miss is how to connect standard language drop down (from logon screen) to my application...

When reading HTML code of logon screen I noticed that drop down's name is ume.logon.locale

Is there any additional configuration to do to tell my web dynpro application about this ume value ?

Should I add some code such as *sap-locale = ume.logon.locale" ?

Former Member
0 Kudos

Try this:

import com.sap.security.api.IUser;

import com.sap.security.api.UMException;

import com.sap.security.api.UMFactory;

try {

IUser user = UMFactory.getAuthenticator().getLoggedInUser(request, response);

Locale userLocale = user.getLocale();

} catch (UMException umEx) {

umEx.printStackTrace();

}

Former Member
0 Kudos

When doing this, I get the user's locale, that is, for example, en.

What I'd like to do is to allow user to choose language when logging in, independantly of their user's language.

For example, one could decide to log in in english in the morning than in german in the afternoon, meanwhile his user's locale is french.

Former Member
0 Kudos

I found the Web Dynpro way for what I coded above on help.sap.com:

http://help.sap.com/saphelp_nw04/helpdata/en/f5/4dd9d47a200d46bd1c56062f49e10b/content.htm