cancel
Showing results for 
Search instead for 
Did you mean: 

Language change - Web dynpro Java

Former Member
0 Kudos
244

Dear All,

We have a Web Dynpro Java application (CE 7.1 SP11), where we have internationalization (defined using xlf) which is working fine (for EN and DE language) when we pass a URL parameter sap-locale (sap-locale=EN or sap-locale=DE) in Web dynpro application url.

Now, when the application is loaded with English language, we have button in Web dynpro view (button "Change Language"), on click of the Button it has to load in German (DE) language.

Please suggest how we can achiev this.

Thanks and regards,

Patana

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Patana

please close discussion

regards

yuval

Former Member
0 Kudos

Hi

Jun, I have just tested it and it works great.

1. Bind your textView to context attribute

2.In wdDoInit(). fill the context with values stored in the message pool

3. When button clicked, re-bind the context to language-specific message stored at the pool.

regards

yuval

junwu
Active Contributor
0 Kudos

i think you are in wrong direction.

user code don't touch i18n, it is handled by web dynpro framework.

Former Member
0 Kudos

Hi Jun

Basically you're right. Language is taken from the web browser... Unless you override it in your code

Let me give you an example: my web browser language is set to Hebrew.

In my app. I decided that when loaded the text will be shown is English ("Good Morning"), which it does.

When I press the button, I load a new message from the message pool, this time the text is in German and it says "Guten Morgen". The new text in German shows on the screen.

Easy

regards

yuval peery

junwu
Active Contributor
0 Kudos

1. language is not just determined by browser, there are many cases, url locale, user profile jvm.... and this is not the point concerning the question raised in the first post.

2. if there are hundreds UI element to be internationalized, i guess you won't go with your customized code......

Former Member
0 Kudos

Hi Jun

1. You are right.

2. The customization code I suggested is not a pefect solution, I agree, but it works. It depends
     on the size of the application, of course.

3. And yet as you know :

OSS Answer : SAP Note #947081

"WebDynpro Java has a known limitation also described in the SAP Note #947081 (Point 9.  Change of locale in Web Dynpro iView).

The Limitation is,

There is one locale assigned per login (user) session. This is done for the first Web Dynpro Java application or Web Dynpro Java iView started in the login session. After detecting the locale, this locale is assigned to the login session and all Web Dynpro applications and all Web Dynpro iViews are started in the same login session. The reason why it has to be this way is that Web Dynpro uses backend connection caches which are associated to the login session and they are locale sensitive"

regards

yuval

junwu
Active Contributor
0 Kudos

for point 3, that's why i wrote "web dynpro won't work in that way(if you go with standard i18n)" in my first reply.

you cannot change the language by button click.

i think in most case, customized i18n is not an option, 

junwu
Active Contributor
0 Kudos
i don't believe web dynpro framework will work in that way.
Former Member
0 Kudos

Hi

1. I assume you load your text when application starts ie. in wdDoInit().

2. If this is the case, you can put the same code in an action bound to your button, only this time
    use the other language xlf you need to switch to.

regards

yuval peery