Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for 
change notification.

The following page has been changed by ErikVullings:
http://wiki.apache.org/tapestry/Tapestry5HowToChangeLocale

The comment on the change is:
Added Nick Westgate's example (2007-08-27) to switch locale

------------------------------------------------------------------------------
  
  See also 
[http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html T5 
Localization Guide]
  
+ 
+ 
+ Nick Westgate also contributed the following snippet to the mailing list:
+ 
+ Create two property files:
+ {{{
+ app_ja.properties
+ app_en.properties
+ }}}
+ 
+ !AppModule.java:
+ {{{
+     configuration.add("tapestry.supported-locales", "en,ja");
+ }}}
+ 
+ Page.html with two action links to select your locale (Japanese or English):
+ {{{
+     <a t:type="ActionLink" t:id="jaLocaleLink" href="#">Japanese</a><br/>
+     <a t:type="ActionLink" t:id="enLocaleLink" href="#">English</a><br/>
+ }}}
+ 
+ Page.java contains the event handlers to switch the locale:
+ {{{
+     @Inject
+     private PersistentLocale persistentLocaleService;
+ 
+ ...
+ 
+     void onActionFromJaLocaleLink()
+     {
+         persistentLocaleService.set(Locale.JAPANESE);
+     }
+ 
+     void onActionFromEnLocaleLink()
+     {
+         persistentLocaleService.set(Locale.ENGLISH);
+     }
+ }}}
+ 

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

Reply via email to