tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cordenier christophe <christophe.corden...@gmail.com>
Subject Re: Tapestry i18n, Messages
Date Thu, 04 Feb 2010 23:30:14 GMT

2010/2/5 Christoph Jäger <christoph.jaeger@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


Developer of wooki @wookicentral.com

> Best Regards,
> Christoph Jäger
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org

Christophe Cordenier.

Developer of wooki @wookicentral.com

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message