[ 
https://issues.apache.org/struts/browse/WW-2774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45312#action_45312
 ] 

Brian Repko commented on WW-2774:
---------------------------------

The core problem is that TextProvider interface has 2 purposes - getting text 
and getting ResourceBundles.  Those need to be split.  In addition, there is no 
separation between the bundles loaded by default (xwork and struts2 messages) 
and the user defined messages.  This is not a simple "patch" - it requires some 
redesign.

I can see this being an improvement - but it should be clearly stated that in 
is current design Struts2 only works with properties file based ResourceBundles 
and does not support ResourceBundle.Control.  I can also see this as an 
improvement since, again, it requires some design/interface changes (really the 
whole i18n thing needs to be fixed quite a bit for Struts2).

We did get around this with a custom TextProvider but it was a total redesign 
and still had to call in to get xwork and struts2 messages.  A hack.

The reason that I consider this a bug is that Struts1 did this by defining 
MessageResources and MessageResourcesFactory interfaces. I know that Struts1 
and Struts2 are not related but this is lost functionality.

> default resource bundles don't load via TextProvider (they have to load via 
> ResourceBundle.getBundle)
> -----------------------------------------------------------------------------------------------------
>
>                 Key: WW-2774
>                 URL: https://issues.apache.org/struts/browse/WW-2774
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Other
>    Affects Versions: 2.0.11.2
>            Reporter: Brian Repko
>             Fix For: Future
>
>
> LocalizedTextUtil.findDefaultText calls LocalizedTextUtil.findResourceBundle 
> directly in order to load ResourceBundles rather than going through 
> TextProvider.getTexts.  By having defaults come from TextProvider we can 
> implement ResourceBundles that come from Spring (MessageSource) or implement 
> our own factories (including calling ResourceBundle.getBundle with a 
> ResourceBundle.Control object on JDK6).
> We have a database-based content management system that does not implement 
> ResourceBundle but does implement MessageSource.  We plan to use the Spring 
> classes to wrap MessageSource but cannot do so for default messages.  Our 
> fallback is to name our MessageSources based on packages / classes and have 
> nothing in the defaults except for xwork-messages.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to