Re: Localization Question
"Howard M. Lewis Ship" <[email protected]> Sun, 5 Jan 2003 09:16:48 -0500
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <005801c2b4c5$160a0e70$3dc41e42@howardczkz2sl3> |
I(f you have compnent MyComponent.jwc the create a MyComponent.properties and put it there. AbstractComponent defines methods getString() (overloaded in a couple of ways) to retrieve a string and supply parmeters to it. ----- Original Message ----- From: "Roberto Saccon" <[email protected]> To: <[email protected]> Sent: Sunday, January 05, 2003 8:53 AM Subject: [Tapestry-developer] Localization Question > Hi there > > Localization works fine in Tapestry for Beans and Localized Strings but how > do I handle a Localized property, I wil call it "foo" in the example below > (which is rendered inside a Foreach-loop) ? Just taking the getString method > form AbstractComponent did not work, so I took the traditional approach, see > below. > Does Tapestry offer a more elegant way, where it is not necessary to > hardcode the RessourceBundle name ??? > > private static final String BUNDLE_NAME = bla.bla.bla > > public String getFoo() > { > ResourceBundle RESOURCE_BUNDLE =ResourceBundle.getBundle(BUNDLE_NAME, > getPage().getEngine().getLocale()); > try > { > return RESOURCE_BUNDLE.getString(key); > } > catch (MissingResourceException e) > { > return '!' + key + '!'; > } > } > > > > regards > Roberto > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Tapestry-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tapestry-developer > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf