You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org> on 2006/03/17 16:43:17 UTC

[jira] Resolved: (TAPESTRY-884) Wrong handling of ResourceBundles in ValidationStrings, when running in non-en environment

     [ http://issues.apache.org/jira/browse/TAPESTRY-884?page=all ]
     
Jesse Kuhnert resolved TAPESTRY-884:
------------------------------------

    Fix Version: 4.1
                 4.0.1
     Resolution: Fixed

fixed

> 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.1, 4.0.2, 4.0.1, 4.0
>  Environment: All (tested in Windows / Tomcat)
>     Reporter: Jarek Woloszyn
>      Fix For: 4.1, 4.0.1

>
> 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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org