Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get field name translation in velocity email template?

Miroslav Kravec September 20, 2016

I've created custom template for certain WF-event, which displays some exact fields in the template.

I retrieve field name translation using:

$textutils.htmlEncode($velocityhelper.getFieldName("customfield_10303", $i18n))

But, it doesn't work reliably. Sometimes it returns english custom field name, even when whole email content is using right translation.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Miroslav Kravec September 20, 2016

I've made it working, I had to dive into the implementation of  the CustomFieldImpl.getName(), and I've ended up with following code:

   

<tr>

        #set($resolutionTextField = $issue.getCustomField("customfield_10303"))

        #set($nameKey = "jira.translation.custom.field" + $resolutionTextField.getId() + "." + "name" + "." + $i18n.getLocale())

        #set($fieldName = $resolutionTextField.getPropertySet().getString($nameKey))

        <th>$textutils.htmlEncode($fieldName):</th>

        <td>$textutils.htmlEncode($issue.getCustomFieldValue("customfield_10303"))</td>

    </tr>
TAGS
AUG Leaders

Atlassian Community Events