Because it’s going to be graphic based, first find some suitable image files to display to the user. Using Google images and searching for flags gave me the ones I use here:
We need to put these into our developer studio project – I keep mine under dist/images/mimes.
Our first component, which I have called PickLanguage, is used to display the images as anchored links that will then invoke the second component.
Here’s the code:
The href string points to my portal component, so if I change the name of the PAR file or component, I need to change this to the appropriate value.
The second component, which I have called ChangeLanguage, sets the user’s language and then launches the portal again…
Make an iView that launches the first component and give it to a portal role, and you should be finished.
As a caveat, you must have an environment in which users can change their portal language. If they can’t do this, then you need to find another way to achieve the dynamic selection.
Good luck!
Very good for a flexible user development to deal with loacales.
Thanks Michael.
Is there a requirement for a portalapps.xml for this deployment. If you have a copy of this deployment is is possible to send it to me.
kai@kaiandrachel.co.uk
Many thanks….
The important bit is:
Cheers
Hello Michael,How to solve the issue …?
private static Locale POLISH = new Locale(“pl”, “PL”);
etc
Thanks in advance.
please can you tell me how you set the locale to spanish… I am unable to set the locale.
I created a new locale as follows:
private static Locale SPANISH = new Locale(“es”, “ES”);
and then set this
if (language.equalsIgnoreCase(“spanish”))
modUser.setLocale(SPANISH);
but its not setting the locale to spanish.
Please can you let me know how to check this. I have a requirement to change the locale to spanish.
Require help here.
Regards,
Vaishali
I have added the following code in PickLanguage.java
response.write(
“); and also added a es.gif in imagesmimes folder
“
when i click on the image in the url is
http://ud1sap01pd1.bhpb.internal:50000/irj/servlet/prt/portal/prtroot/dynamicrole.changelanguage?language=spanish
But still my user language remains english. The language changes only for the ones mentioned in the log.
Please can you let me know where i am going wrong.
Regards,
Vaishali
I have added the following code in PickLanguage.java
response.write(
“); and also added a es.gif in imagesmimes folder
“
when i click on the image in the url is
http://ud1sap01pd1.bhpb.internal:50000/irj/servlet/prt/portal/prtroot/dynamicrole.changelanguage?language=spanish
But still my user language remains english. The language changes only for the ones mentioned in the blog.
Please can you let me know where i am going wrong.
Regards,
Vaishali
please can you tell me how you set the locale to spanish… I am unable to set the locale.
I created a new locale as follows:
private static Locale SPANISH = new Locale(“es”, “ES”);
and then set this
if (language.equalsIgnoreCase(“spanish”))
modUser.setLocale(SPANISH);
But unfortunately the portal language is not set to Spanish.
Please can you let me know how to check this. I have a requirement to change the locale to spanish.
Require help here.
Regards,
Vaishali
nancylam01@yahoo.com
I don’t have a par file for this – it ios a cut and paste from a larger set of code…
Cheers
com.sapportals.portal.prt.runtime.PortalRuntimeException: iView not found: DynamicRole.ChangeLanguage
this is the url:
/irj/servlet/prt/portal/prtroot/DynamicRole.ChooseLanguage?language=english
or
/irj/servlet/prt/portal/prtroot/DynamicRole.ChooseLanguage?language=french
or
/irj/servlet/prt/portal/prtroot/DynamicRole.ChooseLanguage?language=spanish
I’ve got the ChangeLanguage.java class in the .par file
Thanks.
I’m not sure why the component DynamicRole.ChooseLanguage is being invoked. It should be DynamicRole.ChangeLanguage, as this is the name of your Java file.
Is it possible you mistyped the name of the href variable in Pick.java?
Cheers
/irj/portal/prtroot/DynamicRole.ChangeLanguage?language=english
Instead:
“/irj/servlet/prt/portal/prtroot/DynamicRole.ChangeLanguage?language=english
I am getting the follwing error:
com.sapportals.portal.prt.runtime.PortalRuntimeException: iView not found: DynamicRole.PickLanguage
Please can you guide me regarding this.
Hi Michael,
I have similar requirement of creating links for different languages in masthead area. Can you give detail code.