Hi 2010/2/5 Christoph Jäger <christoph.jae...@polleninfo.org>
> Hi, > > I use org.apache.tapestry5.ioc.Messages to get the translated strings for > my web application from the property files for my pages. This works great. > > Now, I want to use the same mechanism in two different places in my > application: > > 1. A user can click a button to generate some graphic or Excel file > containing data. Some strings on the graphic (like title, ...) and in the > Excel file need to be translated, too. So in the code, which creates the > graphic or Excel file, I pass the org.apache.tapestry5.ioc.Messages > instance, which was injected into my page to do the translations. This also > works great. But: sometimes the language used for the graphic or Excel file > is different from the language used on the web page. How can I make the > Messages instance switch the language, or request a new Messages instance > from Tapestry, with the language (Locale) needed for the graphic / Excel > file? > You can use LocalizationSetter.setNonPeristentLocaleFromLocaleName to change the locale without affecting the client locale current locale. > > 2. The application runs some scheduler, which will create reminder emails > once every day. The emails are create from a template, which is filled with > some translated strings. Is there an easy way to ask Tapestry for a Messages > instance (with a given Locale, and based on some class (to query the right > .properties file) as if it were injected into a page), in this background > job, which just runs inside a web application, but does not have any > connection to an actual web request? > Have a look at http://tapestry.apache.org/tapestry5/tapestry-ioc/parallel.html Regards, Christophe. Developer of wooki @wookicentral.com > > Best Regards, > > Christoph Jäger > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Regards, Christophe Cordenier. Developer of wooki @wookicentral.com