Display Issue Notifications in Right To Left Languages

Scenario

'Right to Left' (RTL) Languages such as Arabic, and Hebrew are not currently supported by Atlassian and are rendered incorrectly in the issue view and Notifications. Please see the following for more info:

Atlassian have no plans to support RTL languages, JEMH Custom Templates canan be used to manually set the Text direction and ‘language’ of HTML emails. See the following for more info:

Using the linked page as a guide, this documentation page details how to use these HTML properties to manually configure Right to Left HTML emails.

Overview

To set the text direction of outbound emails to RTL requires the usage of re-usable User Macros.
The macros alters existing templates and setting the following attributes:

  • The text direction to RTL.

  • The Element ‘language’.

The following example will use the Hebrew language, set by the attribute ‘lang=”he”'. For further info on more languages and using RTL please see:

The following Macro examples are to be used in a JEMH Custom Email templates. Replacing existing sections of a template with an RTL format. For more guided info on creating Macros, and JEMH Custom templates Please see the following:

For guidance on applying the new JEMH Email Templates to a Notification Mapping please see the following page:

This configuration only affects HTML emails and cannot be used to render RTL text in a text/plain email.

1. Create a base paragraph Macro for RTL Conversion

Using the Jira Pattern Macros (Which are visible on the JEMH Macros tab) as a guideline, the following Macros can be used to render text in RTL in a specified language.

The rtl_paragraph macro replicates the Jira macro ‘text-paragraph.vm’, however the paragraph is encapsulated in a ‘div’ tag with the rtl, direction and specified language.

#macro(rtl_paragraph) <table class='text-paragraph-pattern' cellspacing='0' cellpadding='0' border='0' width='100%'> <tr> <td class='text-paragraph-pattern-container mobile-resize-text #if ($textParagraphClasses) $textParagraphClasses #end'> <div dir="rtl" lang="he"> $attachmentsManager.inlineImages($textParagraph) </div> </td> </tr> </table> #end

The Jira Macro ‘text-paragraph.vm’ is used repeatedly in Jira templates to render text. By creating an ‘RTL’ version, the rtl_paragraph macro can now be used instead of the original Jira Macro. This Macro can be used to render the issue description

2. Create a RTL Comment Macro

The Comment Macro will not work unless the base paragraph Macro has already been created in Step 1. (Create a base paragraph Macro for RTL Conversion). The following Macros use the rtl_paragraph to render text from right to left.

As with the rtl_paragraph, the existing Jira Macros can be used as a guideline to build a macro for rendering comments. Jira uses the macros ‘text-top.vm’, ‘comment-top.vm’ to render comments. The only change needed to these macros is to make use of your new rtl_paragraph, rather than the ‘text-paragraph.vm’.

Starting with ‘text-top.vm’:

#macro(rtl_text_top) #disable_html_escaping() #if ($topTextContent) #set ($textParagraph = $topTextContent) #rowWrapperNormal("#rtl_paragraph()" "text-paragraph-pattern-top" $textTopPatternClasses) #end #end

And then ‘comment-top.vm’

#macro(rtl_html_comment) #disable_html_escaping() #if ($comment) #set ($commentTopVisibility = $textutils.innerTrim("#visibilityHtml()")) #if ($commentTopVisibility != "") #set ($topTextContent = "$htmlComment $commentTopVisibility") #else #set ($topTextContent = $htmlComment) #end #if ($textutils.stringSet($commentTopPatternClasses)) #set ($textTopPatternClasses = "$commentTopPatternClasses comment-top-pattern") #else #set ($textTopPatternClasses = "comment-top-pattern") #end #rtl_text_top() #elseif ($originalcomment) #set ($originalcommentTopVisibility = $textutils.innerTrim("#originalvisibilityHtml()")) #if ($originalcommentTopVisibility != "") #set ($topTextContent = "$originalhtmlComment $originalcommentTopVisibility") #else #set ($topTextContent = $originalhtmlComment) #end #if ($textutils.stringSet($commentTopPatternClasses)) #set ($textTopPatternClasses = "$commentTopPatternClasses comment-top-pattern") #else #set ($textTopPatternClasses = "comment-top-pattern") #end #rtl_text_top() #end #end

3. Apply Macros in new Custom Template

These new RTL Macros can be used in a Custom Template to replace the original left to right rendering of the Issue description and Comments. For a full example template in use, please import the JEMH Template Sets attached below.

Issue Created

Issue Commented

Example Outcomes

Issue Creation Notification

 

Issue Commented Notification