May I suggest to extend i18n's functionality. Currently you need 
<@ww.i18n name="anyVarReferencingTheBundlesNames">

That seems to me not very obvious. I'd rather like to name the
ResourceBundle like
<@ww.i18n name="com.eds.asset.i18n.I18n_adminapp">

I modified the tag sources as outlined below. It should extend and not
modify the orginal behaviour.

regards
Juergen


    // BodyTag implementation ----------------------------------------
    public int doStartTag() throws JspException {
        // Get bundle
        
        // >>
        ResourceBundle bundle = null;
        try {
                String name = this.findString(nameAttr);
            bundle = (ResourceBundle) findValue("texts('" + name + "')");

            if (bundle == null) {
                bundle = LocalizedTextUtil.findResourceBundle(name, (Locale)
getStack().getContext().get(ActionContext.LOCALE));
            }
            
        } catch (Exception e) {
                // ignore it
        }

        if (bundle == null) {
                try {
                        String name = nameAttr;
                        bundle = (ResourceBundle) findValue("texts('" + name
+ "')");

                        if (bundle == null) {
                                bundle =
LocalizedTextUtil.findResourceBundle(name, (Locale)
getStack().getContext().get(ActionContext.LOCALE));
                        }
                } catch (Exception e) {
                        LogFactory.getLog(getClass()).error("Could not find
the bundle " + nameAttr, e);
                        throw new JspException("Could not find the bundle "
+ nameAttr);
                }
        }
            
        if (bundle != null) {
            final Locale locale = (Locale)
getStack().getContext().get(ActionContext.LOCALE);
            getStack().push(new TextProviderSupport(bundle, new
LocaleProvider() {
                public Locale getLocale() {
                    return locale;
                }
            }));
        }
        // <<
        return EVAL_BODY_INCLUDE;
    }
}

Attachment: I18nTag.java
Description: Binary data

Reply via email to