Jim Barrows wrote:



-----Original Message-----
From: Ritchie Warsito [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 4:36 AM
To: Struts Users Mailing List
Subject: I8N - Locale switch on any page


Hey there,
I'm studying the struts-mailreader example and as some of you might know (I hope), you have the option to switch languages (different ApplicationResources).
The thing is, and I've read this on many other sites that this is the common way to do it, is that the locale options are only on the first (welcome) page, and from there on the selected locale will be used.


I want these options on every page throughout my application and when selecting, it will return to the page where you selected it from. With PHP i know how to do this, but this whole JSP/Struts is new for me.
So is this possible and more importantly how?



Of course it's possible. JSP/Struts is more capable then PHP. Question is why? Most browsers provide locale, which struts uses to do the i18n for you. Much easier. See Java's I18N tutorial, and Struts/JSTL I18N tutorial for details.
In answer to your question.. how did you do it in PHP? probably some sort of link and back to the page. You could create a link with the current page as a parameter. The action would set the locale chosen, and return to the parameter.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




About the php way, you're right, my url would look something like xxx.php?language=en&pageid=2 or something.
The strutsmailreader has a page parameter in its action class, but it's not really clear to me how it's used. Looking at the struts config it just says when doing the Locale action (with a global forward as a parameter), it just returns to that global forward which is the welcome page where the locale options are.
So in this example you HAVE to choose the language at the first page.


So does anyone have an example maybe on how to accomplish what I want?
Tnx
Ritchie

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to