One of our clients came up with a requirement wherein they want a webdynpro application which should have a drop-down to select a language. On selection of language, only that WD Application should be running in that language without affecting the portal logon/personalized language.So thought of sharing the solution.
One would think this can be achieved using SAP Standard mechanism of Internationalization.
Here the client doesn't want to change the portal logon language. The user will select language only for that application and not for all the application. Hence internationalization would not work.So here is the alternative.
Add all the texts in all the languages you want to maintain in Message Pool. For e.g. we will maintain 2 languages: English and Chinese
Strictly follow the convention of the key: <language key from portal>_title<number>
Create a Simple type: language. This is for Language dropdown box.
Here also follow strictly the naming convention where Value = Portal Language Key
Open the View of Webdynpro Component and create Context elements for holding texts from message pool depanding upon language selected.
Also create the required Layout.
Associate and action with Dropdownbox event onSelect.
Now comes the most important part... coding...
Deploy new Archive and Run.
Create Portal View for this WD Application and assign it to a page, then page to a workset and finally workset to a Role.
Give a user this role.
Login to portal with the user having this role.
Default it will display the application in language as of personalized in portal if its maintained in message pool, otherwise by default it will pick English.
Select Chinese from drop down, application will run in Chinese without affecting portal language.
- Now in future you want to add support to one more language then you need to add the required language in Simple type Enumeration, add all the title text in that language in message pool. Deploy new Archive and Run.
- Another solution approach is to use properties file which is easier to maintain if more languages needs to be added in future (Thats the part II- Comming Soon)