cancel
Showing results for 
Search instead for 
Did you mean: 

how to set languages for webdynpro object

Former Member
0 Kudos

Dear all,

I want to set thwo languages for my webdynpro application.

<b>EN</b> and <b>TH</b>. Can anybody suggest how to go about it??

Regds,

Anup.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Nibu

i needed a help from u .

I'm trying to change the language of a webdynpro depending on value selected in the dropdown.

I have a dropdown in the first page and have made the required .xlf files.In the second view,

i need to display the labels in the language selected in the dropdown.

can u help me in this matter.

Thanks in Advance.

Former Member
0 Kudos

It depends if your Webdynpro applications is running through portal or not.

When running through EP, the screens are displayed using the defined/connected portal user's language. Setup by the portal user or admin.

Also, if the data content comes through JCO and RFC calls to R/3, the data language is defined by the data dictionnary through the "R/3 user" language. In this case, you have to setup the JCO language definition on the J2EE server.

Former Member
0 Kudos

Dear Michael/Sarvanan,

Thanks for your help..

Is there any way where i ask the user to enter the language key and then make it language specific,

Regds,

Anup.

Former Member
0 Kudos

Hi Anup,

The only way to achieve this functionality is to forcefully log-off the user & relogin with the selected locale. But if used for an authenticated application, the user needs to enter his credentials again. In case of anonymous users, this works perfectly.

First, follow the tutorial https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/in... of web dynpro applications.pdf and create the required .xlf files. Test the applicatin in both languages by changing the browser's language priority. (But note that this has no effect for authenticated users). And in most cases, you need to close & open the project for the changes to take effect in the xlf files.

Now provide a dropdownbox or any selectable UI element for language slection, with key values as 'en_US' and 'th_TH'. Let the attribute bound to the dropdown be 'selected_language'. Now in the action handler for the 'onSelect' of the dropdown write this code :

final String locale = wdContext.currentContextElement().getLanguage_selection();

try

{

final String url = WDURLGenerator.getApplicationURL(

wdComponentAPI.getApplication().getDeployableObjectPart(),Collections.singletonMap("sap-locale", locale));

WDClientUser.forceLogoffClientUser(url);

}

catch (final WDURLException ex)

{

wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(ex), false);

}

After this, when you select "TH" from the dropdown, the application will be reloaded with that language.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Dear Nibu,

Thanks for this approach..But before trying this method i wish to ask you one thing that will it also convert the data that we are retrieving from r/3??...i mean the data wich, BAPI is bringing from r/3 to EP??. Please give your valuable suggestion..

Regards,

Anup.

Former Member
0 Kudos

Hi Prakash,

This doesn't do the <b>translation of any data </b> at runtime. Instead we create and store the translated text at design time, and at run time, depending on the locale selected, the corresponding texts are retrieved and shown. So there is no scope for converting the data retrieved from R/3. What you can do is, modify your RFC so that it accepts the language as an input parameter and returns language specific values.

Best Regards,

Nibu.

Former Member
0 Kudos

Thnaks everybody...

Thanks NIBU...

Regds,

Anup.

Former Member
0 Kudos

Hi Anup,

Please close this thread by awarding appropriate points.

Best Regards,

Nibu.

Former Member
0 Kudos

Hi,

First approach

1. Set the all the translatable texts for each UI element in the view.

2. copy the automatically generated *.xlf files and

save them under a new name in the same directory. The

new name must meet the following convention:

• <old name>_<language key>.xlf

3. open this file and then enter ur text. Based on the language setting in the browser particular language text will be displayed

Second approach

Using the java resource bundle. I havent try this.

Have a look at this link.

http://help.sap.com/saphelp_erp2004/helpdata/en/2d/e7381138a8d2458f1f4fac32614f71/content.htm

Thanks

Saravanan.