Submit a request
Submit a request

Configuring Items API to Initialize in RTL (Right-to-Left) Mode (Arabic and Hebrew Language Support)

Assess API has introduced the ability to have Items API (with Assessment player) initialize to display content from right-to-left (RTL), to support languages such as Arabic.

This feature helps facilitate internationalization of the assessment player and assessments for languages that rely on RTL script.

RTL support is available right now on Items API latest and Assess API latest only.

Steps required

  1. Initializing Items API in RTL mode.
  2. Internationalization of Assess player UI via label bundles.

 

1. Initializing Items API in RTL mode

Right-To-Left script mode for Assess API has only minimal additional criteria on top of the regular initialization of Assess API.

It requires that a lrn-rtl class is applied to the body of the page where Assess API is being initialized, and a direction attribute of "rtl" be set on the API elements wrapper; dir="rtl".

In conjunction with the internationalization configurations available (compiled below), Items API with assessment player can be flexibly localized.

<body class="lrn-rtl">
<section dir="rtl">
<span id="learnosity_assess"></span>
</section>
<script src="//items.learnosity.com/"></script>
<script>
var initOptions = {
// Security setup, etc.
...
"request": {
...
"rendering_type": "assess",
"config": {
...
"labelBundle": {
// Here is where we can replace UI labels
// for the Assess player with key-value pairs
// (referenced below)
...
},
"questions_api_init_options": {
"labelBundle": {
// Here is where we can replace
// UI labels for Questions API
// with key-value pairs (referenced below)
...
}
}
}
}
};
var itemsApp = LearnosityItems.init(initOptions);
</script>
</body>

Code Example 1: Items API Internationalization Configurations

 

2. Internationalization of Assess player UI via label bundles

All requisite APIs support internationalization (i18n) via label bundles.

The following pages on the reference site detail the label lists, keys and their defaults:

All label bundles are included during initialization as objects containing the relevant key-value pairs.
Items API can include label bundles (as well as relevant initialization attributes) for both the Assessment player and Questions API.

// Example initialization object for Items API
// containing label bundles reference for the
// Assessment player and Questions API
var initOptions = {
...
"request": {
"config": {
...
labelBundle: {
"calculator": "آلة حاسبة",
"yes": "نعم فعلا",
"no": "لا",
...
},
"questions_api_init_options": {
"init_options": {
labelBundle: {
"calculator": "آلة حاسبة",
"checkAnswer": "تحقق من الجواب",
"checkAnswers": "تحقق من الإجابات",
...
},
}
}
}
}
};
var authorApp = LearnosityAuthor.init(initOptions);

Code Example 2: Label Bundles for Assess API and Items API

 

Next steps

For more information, see the article about Configuring Author API in RTL mode

Was this article helpful?
0 out of 0 found this helpful

Did you arrive here by accident? If so, learn more about Learnosity by clicking here.