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

ASF GitHub Bot commented on WW-4295:
------------------------------------

GitHub user lukaszlenart opened a pull request:

    https://github.com/apache/struts/pull/18

    Feature: list value localization

    This is continuation of @abrin work started in #7
    
    Closes [WW-4295](https://issues.apache.org/jira/browse/WW-4295)
    Closes #7 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/struts feature/WW-4295-localization

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/struts/pull/18.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18
    
----
commit 7f586d39b7f8411e22fd13de8025f1866477fc3c
Author: adam brin <adam.b...@asu.edu>
Date:   2014-03-18T14:36:28Z

    [PATCH] First attempt at enabling value-labels to be pulled from
     Locale Files.  Adding listValueKey attribute to checkboxList, radioMap, and
     select tags.
    
    Issues:
    This implementation uses the <@s.text> tag to handle the localization with 
an assignment. I presume this is less than idea, but I lack the knowledge of 
the Struts2 tag model that would suggest where to check for this on the 
valueStack or elsewhere.
    
    Example:
    
    public enum yesno {
    YES, NO;
    }
    
    <@s.radio name="yes no" list="#{yesno.values()}" valueKey="name()" />
    
    <!-- this will look for the name() in the locale file and emit the 
localized value for the label of the radio button.

commit 901893628b31ee3b38b2fc9196045a097a0f4217
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-03-20T07:08:03Z

    Adds additional field to allow set label key used in I18N lookup

commit 69df87047ab2a72c339a0ee320459757ba439f40
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-03-20T07:08:27Z

    Extends template to use the new field to localise value's label

commit 7e98fe7a731b44bb85375f9363465838803a0a16
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-03-20T07:08:50Z

    Adds autogenerated files

commit b78349ad5dade8a47fb335f6ef18c13a36101842
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-03-20T07:12:13Z

    Extends blank app to demonstrate the new possibilities

commit 6def514524e81c4af188b47b6694384eea3a46c6
Author: adam brin <adam.b...@asu.edu>
Date:   2014-03-24T14:31:54Z

    updating ListUIBean
    
    updating java-backed bean

commit 23498a332119486a043e852366dfb73495a510d9
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T06:40:49Z

    Merge remote-tracking branch 'abrin/feature-WW-4295-localization' into 
feature/WW-4295-localization

commit ca230ab30fde249d8af17cc5f2ba83ebe142d364
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T10:54:26Z

    Adds auto-generated tags' info

commit 13269fa15f02409732ca51545141a40ae2f4680c
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T10:54:44Z

    Adds missing tag attribute field

commit a2791a8305666859d6484098fb597f93c94908bc
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T10:55:13Z

    Removes optional valueKey to keep backward compatibility

commit ed8a0b87b29114ac5c99838e7d4cfc819ad71e43
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T10:55:43Z

    Checks is ListValueKey was defined and returns value

commit d67fce1f2577229139938d4588bb970c3f869078
Author: Lukasz Lenart <lukaszlen...@apache.org>
Date:   2014-06-27T10:56:01Z

    Extends test to use the new attribute

----


> provide better documentation and / or functionality for localization of 
> struts2 tag elements (select, radio, etc.)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4295
>                 URL: https://issues.apache.org/jira/browse/WW-4295
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.3.16
>            Reporter: adam brin
>             Fix For: 2.3.18
>
>         Attachments: WW-4295.patch
>
>
> The <@s.text> macro is very useful for localization of text values.  The 
> <@s.textfield tag also takes a "key" > but, the select, radio, and checkbox 
> options don't have good options for localization.  One option raised on the 
> list and identified in a few places is to construct a separate map of 
> variables that have been localized in Freemarker and use that for 
> localization 
> (https://stackoverflow.com/questions/5548104/struts-select-tag-localization-implementation/17258640#17258640)...
>  this does not seem sustainable or maintainable. Two possible methods for 
> addressing this might be:
> # update the documentation to better identify how to localize these values in 
> the "approved" way
> # implement a listKey parameter that like the textfield implementation or 
> other implementations might call getText() on the key prior to rendering
> {code:title=Example Implementation for Radiobutton}
>     <#if parameters.listKey??>
>         <#assign itemValue><@s.text 
> name="${stack.findString(parameters.listKey)}" /><#rt></#assign>    
>     <#elseif parameters.listValue??>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to