Hi Thiago,
That's actually a clever solution, but seems a bit "hacky" and I'm not
sure how it will also use the usual Index(_en).properties files?
I solved it at the moment with adding a new binding prefix where i pass
the key and property value like following:
${messagebasedonpropertyvalue:messagekey=property}
Then in the binding implementation I get the resourcebundle based on the
property value and retrieve the message by given key.
This works as I hoped.
I am starting to doubt that having this many properties files for just 1
page/component is the way to go though. Maybe I'll have to move it to
the database or somewhere else.
Thanks for your insight!
Nathan
On 11/08/15 16:33, Thiago H de Paula Figueiredo wrote:
On Tue, 11 Aug 2015 03:29:13 -0300, Nathan Quirynen
<nat...@pensionarchitects.be> wrote:
So I want to have the usual properties file for the page and besides
this for each possible value of a property an extra properties files in
which specific localized messages are located.
So for example an Index page it can have the following:
- Index.properties
- Index_en.properties
- Index_120.properties
- Index_120_en.properties
- Index_130.properties
- Index_130_en.properties
- ...
But when the page loads the value of the property is for example 120
then Index.properties and Index_120.properties wil have to be used.
I hope it is more clear now. So i need to load the messages catalogs
depending on the property value.
I'd try this: @Inject ThreadLocale threadLocale, then in your page's
onActivate() method call threadLocale(new Locale("[current language
code]", [property value]), then use ${message:xxx} or @Inject Messages
as usual. You'd need to revert the naming convention: instead of
Index_130_en.properties, Index_en_130.properties. The idea is using
locale country or even variant, as supported in Locale(String
language, String country) and Locale(String language, String country,
String variant) constructors of java.util.Locale.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org