Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-11331

I18n with CustomField

XMLWordPrintable

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      Following an old issue (JRA-6481), our requirment for i18n implementation is more and mroe important at the moment.

      • May we know when a such feature will be implemented in future release ?
      • Trying to understand how customfield rendering is done, I found a way to apply i18n translation.
        I proceed so :
        • Creating the CustomField as i18n keys : myCustomField
        • Adding the CustomField property value in a rebuild language_fr_FR.jar
          com/atlassian/jira/web/action/JiraWebActionSupport_fr.properties
          myCustomField=Mon Champ personnalisé
        • Adding the CustomField property value in a rebuild language_en_UK.jar
          com/atlassian/jira/web/action/JiraWebActionSupport_en.properties
          myCustomField=My Custom Field
        • ... and alos for any other required languages.
        • Modifying templates/plugins/jira/macros.vm as follow :
          • a new Macro
            ## I18n Headers required for CustomFields
            #macro(i18nCustomName $action $name)
                #set ($wordPos = $name.indexOf(" "))
                #if ($wordPos>0) 
                	#set($key=$name.substring(0,$wordPos)) 
                	$action.getText($key) $name.substring($wordPos,$name.length())
                #else
                	$action.getText($name)
                #end
            #end
          • Replacement of
            #if ($required)
                <span class="required" title="$action.getText("common.forms.requiredfields")"><sup>*</sup>
                $name:
                </span>
            #else
                $name:
            #end

            by

            #if ($required)
                <span class="required" title="$action.getText("common.forms.requiredfields")"><sup>*</sup>
                #i18nCustomName($action $name) :
                </span>
            #else
                #i18nCustomName($action $name) :
            #end
        • Modify includes/panels/issue/view_customfields.jsp as follow :
          Replacement of
          <tr id="rowFor<webwork:property value="./id" />">
              <td bgcolor="f0f0f0" width="20%" valign="top"><b><webwork:property value="name" />:</b></td>
              <td bgcolor="ffffff" width="80%">
                  <webwork:property value="/customFieldHtml(../fieldLayoutItem,., /issueObject)" escape="false" />
              </td>
          </tr>

          by

          <tr id="rowFor<webwork:property value="./id" />">
              <td bgcolor="f0f0f0" width="20%" valign="top"><b><webwork:property value="text(./name)" />:</b></td>
              <td bgcolor="ffffff" width="80%">
                  <webwork:property value="/customFieldHtml(../fieldLayoutItem,., /issueObject)" escape="false" />
              </td>
          </tr>

      Please, let me know if I may implement this, waiting the future feature ?
      What other problem may I encounter ? Probably Word and Excel rendering, I suppose ?

      Rgds
      Vincent

        1. customfieldtrans.png
          39 kB
          Ralf Neubersch
        2. src.zip
          23 kB
          Ralf Neubersch

              Unassigned Unassigned
              5d77aaa81033 Vincent Thoulé
              Votes:
              60 Vote for this issue
              Watchers:
              46 Start watching this issue

                Created:
                Updated:
                Resolved: