James Chaplin created WW-5112:
---------------------------------
Summary: Add ability (control flag) for TextProviders to
prioritize reads from the default resource bundlest.
Key: WW-5112
URL: https://issues.apache.org/jira/browse/WW-5112
Project: Struts 2
Issue Type: Improvement
Components: Core
Affects Versions: 2.6
Reporter: James Chaplin
Fix For: 2.6
This proposed improvement derives from a discussion on the Struts Developer
List, with the general idea introduced by Greg Huber.
Improvement: Introduce a new STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST control
flag constant, and accompanying logic, with the default setting being _false_.
The new control flag will be used by AbstractLocalizedTextProvider descendants
to identify alternative I18N resource bundle lookup logic that prioritizes key
lookup in the default resource bundles (in cases where such a distinction makes
sense).
The StrutsLocalizedTextProvider will use the flag to determine whether searches
for resources will check the default bundles first (if the flag is _true_) or
last (if the flag is _false_) for a match to a lookup key. The
GlobalLocalizedTextProvider only searches default bundles, so the flag will
have no effect on it.
The _false_ setting corresponds to the standard lookup logic for the
TextProviders in Struts 2, and will be the default, so that there will be no
impact to existing applications. Applications that wish to enable the
alternate lookup will do so by setting the flag to _true_ in their Struts
configuration.
With a _true_ setting, if a key exists in a default resource bundle (such as
the application's default resource bundle), it will supersede any such key in
other bundles (such as ones at the package or class level). This will allow
for a different resource bundle strategy when using the
StrutsLocalizedTextProvider, and may be more efficient for applications that
either only use a single global application resource bundle. or that use such a
bundle for the vast majority of their I18N resource keys.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)