Vinicius Carvalho wrote:
Hello ppl. Once again here I am. As my presentation gets closer, I'd like to have things shinning :DI just implemented localization with Tapestry (It's so easy that I can't even calculate the effort for doing it ). Here's how I've done: I have a LocaleChange Component with a listener: public void changeLocale(IRequestCycle cycle){ String language = (String)cycle.getServiceParameters()[0]; String country = null; if(language.equals("pt")){ country = "BR"; } else country = "US"; Locale locale = new Locale(language,country); getPage().getEngine().setLocale(locale); cycle.activate(getPage()); } <component id="brazil" type="DirectLink"> <binding name="listener" expression="listeners.changeLocale"/> <static-binding name="parameters" value="pt"/> </component> <component id="us" type="DirectLink"> <binding name="listener" expression="listeners.changeLocale"/> <static-binding name="parameters" value="en"/> </component> <context-asset name="brazilianFlag" path="images/brazil.gif"/> <context-asset name="usFlag" path="images/usa.gif"/> Due my high level of stupidity I did not figure out yet how to pass more than one parameter using binding so I decided to do that ugly trick (if-else). It changes the locale, but the activate returns to the caller page with the previous idiom. One must click in another page to see the results. I thought that by forcing cycle.activate() that would be done automatically.
No, it's done done automatically. However, you can throw a PageRedirectException and make it redirect to the current active page. This will do the trick!
Any ideas? Thanks all --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
