Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4295

provide better documentation and / or functionality for localization of struts2 tag elements (select, radio, etc.)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.16
    • Fix Version/s: 2.3.20
    • Component/s: None
    • Labels:
      None

      Description

      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:

      1. update the documentation to better identify how to localize these values in the "approved" way
      2. implement a listKey parameter that like the textfield implementation or other implementations might call getText() on the key prior to rendering
      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>
      

        Attachments

        1. WW-4295.patch
          4 kB
          adam brin

          Issue Links

            Activity

              People

              • Assignee:
                lukaszlenart Lukasz Lenart
                Reporter:
                abrin adam brin
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: