IMO Localizer.getString() is bit akward to use. It currently looks like

        public String getString(final String key, final Component component,
final IModel model,
                        final Locale locale, final String style, final String 
defaultValue)
                        throws MissingResourceException
        {
               ....
                // Resource not found, so handle missing resources based on 
application
                // configuration
                if (settings.getUseDefaultOnMissingResource() && defaultValue 
!= null)
                {
                        return defaultValue;
                }

                if (settings.getThrowExceptionOnMissingResource())
                {
                        throw new MissingResourceException("Unable to find 
resource: " +
key, getClass()
                                        .getName(), key);
                }
                else
                {
                        return "[Warning: String resource for '" + key + "' not 
found]";
                }
        }

What I would like to change:
Define two getString() methods. One with defaultValue and one without.
If defaultValue method is used, return the defaultValue if the
resourcekey is not found, no matter whether defaultValue is null or
not. And remove getUseDefaultOnMissingResource() from the API.
getString() without defaultValue throws an exception, if settings flag
is true and resourcekey was not found. Else call
getDefaultErrorText(key) to construct a default key.
In order to allow for subclassing Localizer we implement
newLocalizer() { this.localizer = new Localizer()} in wicket
application.
IMO is would make Localizer.getString more easy and straight forward
to use, besides that it would be extensible now, if realy required.

what do you think?
Jürgen


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to