You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jesper Zedlitz <jz...@informatik.uni-kiel.de> on 2008/03/01 17:16:31 UTC

[FAQ] changing locale

Q: How do I implement a language selection?

A:
src/main/java/org/example/myapp/pages
public class SelectLanguage {
    @Inject
    private PersistentLocale persistentLocale;

    public void onChangeLocale(final String language) {
               persistentLocale.set(new Locale(language));
    }
}

src/main/webapp/SelectLanguage.tml
<a t:type="EventLink" t:event="ChangeLocale" t:context="'de'"
href="#">German</a><br/>
<a t:type="EventLink" t:event="ChangeLocale" t:context="'en'"
href="#">English</a><br/>


-- 
Jesper Zedlitz                   Dept. for Computer Science, CAU of Kiel
Room 1108                        Communication Systems Research Group
                                 Phone:    +49-(0)431-880-7279
Christian-Albrechts-Platz 4      Fax:      +49-(0)431-880-7615
24098 Kiel - Germany             jze@informatik.uni-kiel.de


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org