Right to left support in templates
Platform renders text in document templates and mail templates from left to right (LTR). Unlike on application pages, Platform does not automatically set the text direction based on the language. However, you can edit your template content to render some or all text from right to left (RTL).
Document templates
For HTML document templates, you can override this behavior and render text RTL for the whole document, for individual elements, and within an element for a portion of the text. The following attribute and element enable this control:
- The
dir
attribute — This attribute specifies the text direction. Its possible values areltr
,rtl
, andauto
, whereauto
renders the text based on the language. Add this attribute to an HTML element, such as a section or paragraph, to specify the text direction. For example, to render the entire document as RTL, add it to thehtml
element:<html dir=”rtl” >
- The
bdi
element — This element isolates a part of text that might be formatted in a different direction from other text outside it. It is helpful when the user-generated content has an unknown direction. For example, if a parent element sets thedir
attribute tortl
, and user-generated text could be in Spanish, using thebdi
element ensures that the text is rendered in the appropriate direction.
For Microsoft Word document templates (DOC/DOCX), the default alignment is left. You can use the rich text editor to keep headings and other titles right aligned.
For XLS, XLSX, RTF, TXT, and XML document templates, you can align the text as required for the language.
Mail templates
To use RTL text in mail templates, do the following:
- Set the email encoding to UTF-8 on the My Settings.
- When creating a mail template, select HTML as the format. See Email templates for information about creating mail
templates. Use the
dir
attribute and thebdi
element as described above to format the text direction of the HTML content.
For more information about language support, see Language support.