$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

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:

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

Create a RTL Comment Macro

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

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.

Issue Created

...
#if ($issue.description)
    #set($textParagraph = $issue.htmlDescription)
    #rowWrapperNormalBegin('', 'issue-description-container')
    #rtl_paragraph()
    #rowWrapperNormalEnd()
#end
...

Issue Commented

...
#rtl_html_comment()
##parse("#rtl_html_comment()")
... 

Example Outcomes

Issue Creation Notification

Issue Commented Notification

  • No labels