[ http://mc4j.org/jira/browse/STS-151?page=comments#action_10322 ] 

Sebastian Beigel commented on STS-151:
--------------------------------------

Any progress on this one? Today, I discovered my need for this :)

I patched InputOptionsCollectionTag#doStartTag() like this:

...
                Object label = null;
                if (labelProperty != null) {
                    label = OgnlUtil.getValue(labelProperty, item);

                    String localizedLabel = 
LocalizationUtility.getLocalizedFieldName(label.toString(), ((InputTagSupport) 
getParent()).getParentFormTag().getAction(), locale);
                    if (localizedLabel != null) {
                        label = localizedLabel;
                    }
                }
                else {
                    label = item;
                }

...

This works for me though it is not conform with Jeppe's/Tim's idea to use the 
"value" attribute to lookup the localized values. In my use case, I have to 
localize special labels but the "value" attribute is rendered using an id so I 
have to use the "label"-attribute as resource key.

Maybe we could cascade the lookup like this (execution stops with non-null 
result):

- lookup by "label" (and actionPath."label") - [only if label is present!]
- lookup by "value" (and actionPath."value")
- use label (no lookup)
- use value as label

What do you think?

> Ability for stripes:options-collection to localize values
> ---------------------------------------------------------
>
>          Key: STS-151
>          URL: http://mc4j.org/jira/browse/STS-151
>      Project: Stripes
>         Type: Improvement

>   Components: Tag Library
>     Reporter: Jeppe Cramon
>     Assignee: Tim Fennell

>
> Creating on behalf of Jeppe who requested this in the comments of another 
> issue.  The idea would be to localize the text that the user sees for each 
> option.
> Jeppe: do you have a good idea of how you would like this to work?  Should 
> the lookup using the 'value' attribute supplied, or the 'label' attribute 
> supplied?  Do you think this should lookup using className.value or something 
> else?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to