Igor Drobiazko wrote
> 
> Tapestry provides its own MessageInterpolator which is the wrapper around
> the default one. Tapestry's interpolator is using ThreadLocale#getLocale()
> in MessageInterpolator#interpolate without Locale parameter. Check this
> out.
> 
> https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/MessageInterpolatorImpl.java
> 
> I guess the problem is that you didn't place the translations into a file
> expected by the Bean Validation API. So far only these files are
> supported,
> Tapestry's message catalog not.
> 

Thanx Igor - you're right!

I found the problem: it is related to a Bug in the Java ResourceBundle
implementation (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6463986).

Given you have Locale.getDefaultLocale == "de" (-Duser.language=de)
and you have the following files:
test.properties with text test=English
test_de.properties with text test=Deutsch
When you get the bundle with ResourceBundle.getBundle("test.properties",
Locale.ENGLISH)
and you call bundle.getString("test")
then you will get "Deutsch".

This is not what you would think would happen. You can solve this by
creating an empty file test_en.properties - then the fallback works as
expected.

Tapestry's Message implementation does not have this bug :)

-- 
Chris

PS: by the way - here's the code and the link to the running version of a
simple crud app with jsr303:
https://github.com/derkoe/tapestry-javamagazin
http://tapestry-javamagazin2.cloudfoundry.com/

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Bean-Validation-Localization-tp5538273p5541534.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

Reply via email to