Now that Progress Rollbase has RTL support, you can develop without language limitations. Learn how to enable this in your templates and reports.
An application meant for a global audience must support multiple languages and character sets. While many languages are read by scanning letters from left to right, some, such as Arabic and Hebrew, are written and read from right to left (RTL). With the 4.3 release, Rollbase provides official support for RTL rendering.
In general, RTL rendering for the Rollbase UI is taken care of based on the user’s base language. As templates and reports are user specific, enabling RTL requires making minor changes to override the default LTR rendering. Read on to see the ease with which RTL rendering can be achieved in templates and reports in Rollbase applications.
Rollbase templates are text and binary documents that include tokens. At runtime, Rollbase replaces the tokens with record data. See the documentation for more information on templates.
Rollbase supports document and mail templates. The following sections describe how to achieve RTL rendering in each.
Rollbase supports various formats for document templates. HTML templates need changes with respect to the code, and others are pretty straightforward. Let’s discuss each in detail:
HTML: By default, Rollbase renders text left to right. You can edit the template to override the default behavior. You can apply RTL rendering the whole document, to individual elements and within an element for a portion of the text. The dir attribute works in HTML elements. The bi-directional isolation (bdi) tag works within elements for a portion of the text.
Possible values for dir are:
For more on the dir attribute, see this w3 org article. For more on the bdi tag, you can read more at w3schools.
You have to edit the templates to add these attributes and as required. For example, add the following to an HTML element, such as a section or paragraph, to enable right to left rendering:
dir=”rtl”
To render the full document RTL, add the attribute to the html tag as shown below:
<html dir=”rtl” >
Example Code Snippet: Sample template using the Arabic language
<
html
dir
=
"rtl"
>
<
body
>
<
div
>
<
table
>
<
tr
><
td
>صباح الخير</
td
></
tr
>
<
tr
><
td
> {!name#text} </
td
></
tr
>
<
tr
><
td
>أتمنى لك نهارا سعيد</
td
></
tr
>
</
table
>
</
div
>
</
body
>
</
html
>
Example Code Snippet: Sample template using the English language
Note that we did not use the “dir” attribute here because LTR rendering is the default.
<
html
>
<
body
>
<
div
>
<
table
>
<
tr
><
td
>Good Morning!</
td
></
tr
>
<
tr
><
td
> {!name#text} </
td
></
tr
>
<
tr
><
td
>Have a nice day</
td
></
tr
>
</
table
>
</
div
>
</
body
>
</
html
>
The <bdi> tag isolates a part of text that might be formatted in a different direction from other text outside it.
This tag is helpful when the user generated content is involved with unknown directionality. For example, user generated content can be in any language and it would be inappropriate to render a fixed direction in such cases.
Example Code Snippet:
<
div
>
<
p
><
bdi
>{!name#text} </
bdi
></
p
>
</
div
>
Mail templates provide a convenient way to generate the title, body, and attachments for template-based emails from within Rollbase. To use RTL mode in mail templates, follow these steps:
Example Code Snippet:
<
div
dir
=
"rtl"
>
<
p
>مرحبا</
p
>
<
p
>{!name#text} </
p
>
<
p
>تمنى لك نهارا سعيد</
p
>
</
div
>
For details, see the image below:
Rollbase includes the following types of reports:
Example Code Snippet:
<
html
dir=”rtl”>
<
head
></
head
>
<
body
dir
=
"rtl"
>
مرحب
{!#LOOP_BEGIN.all#hS32ScSmS2KB3_R3HSv_qg}
</
br
>
{!name#text}
</
br
>
{!#LOOP_END.all}
أتمنى لك نهارا سعيد
</
body
>
</
html
>
For more details, refer to the screen below:
For this use case, you can either select a stylesheet from the CSS Stylesheet dropdown or you can specify that the body uses the direction attribute with a value of rtl as shown below:
body {direction: rtl;}
Refer to the screen below for more details:
You can edit selected sections of the report and add the styling accordingly.
<
div
class
=
'rbs-cr-htmlSection'
style
=
'direction:rtl'
>
مرحبا
</
div
>
Rollbase RTL support removes the language limitations and offers freedom and flexibility to application developers who can customize templates and reports. This enables developers to improve the user experience for a wider range of customers and to support a truly global audience.
Ranjana is a Senior Software Engineer with 7+ years of development experience, including nearly 3 years of experience in Rollbase. She has worked on various key features like Rollbase-Cloud Service Integration, Rollbase OpenEdge SPA and Rollbase Telerik integration. She's currently working on Rollbase UI using Kendo UI.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites