Wrong handling of ResourceBundles in ValidationStrings, when running in non-en 
environment
------------------------------------------------------------------------------------------

         Key: TAPESTRY-884
         URL: http://issues.apache.org/jira/browse/TAPESTRY-884
     Project: Tapestry
        Type: Bug
  Components: Framework  
    Versions: 4.0, 4.1, 4.0.1, 4.0.2    
 Environment: All (tested in Windows / Tomcat)
    Reporter: Jarek Woloszyn


Tapestry uses ValidationStrings class to handle translations for error 
messages.  
This class should return a message from the ValidationStrings.properties, which 
correspond to the current locale in Tapestry.

When Tapestry is used in the non-en environment (System properties 
user.language/user.country set i.e. to DE), the messages are displayed in the 
default locale instead of the current locale of tapestry. This happens even 
when accepted-locale are set in Tapestry to en only.

The buggy function is ValidationStrings.getMessagePattern, which looks like:

    public static String getMessagePattern(String key, Locale locale)
    {
        return ResourceBundle.getBundle(RESOURCE_BUNDLE, locale).getString(key);
    }

It tries to get a localized message from the resource bundle. When you read 
JavaDoc for getBundle, it says, how the resolving works. And the strategy is:

bundle_[locale-from-parameter]
bundle_[default-locale]
bundle

So in my case, it was trying:
ValidationStrings_en
ValidationStrings_de
ValidationStrings

ValidationStrings_en doesn't exists so the german translation was taken. 

To fix this, you should create a translation bundle also for english 
(ValidationStrings_en).  


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to