Right-To-Left (RTL) Support

📘

Platforms: Tizen and WebOS.

Supported TVs: Samsung and WebOS.

Overview

This document outlines how to enable and support Right-To-Left (RTL) languages in your application to ensure correct layout, proper text alignment, and an optimal user experience for RTL language speakers.

What is RTL?

RTL (Right-To-Left) refers to languages that are written and read from the right side of the page or screen to the left. Refer to the table below for more information on common RTL languages.

LanguageExample Script
Arabicالعربية
Hebrewעברית
Persianفارسی
Urduاردو

To enable RTL support

Public method isRTLayout()

Returns true or false.

Return ValueAction Required
trueCall OneTrust.setRemoteKeys() with the RTL key codes.
falseCall OneTrust.setRemoteKeys() with the regular (LTR) key codes.

OneTrust TV SDK Key Codes

RTL key codes

Key CodeAction
ArrowRightLEFT
ArrowLeftRIGHT

LTR key codes

Key CodeAction
ArrowRightRIGHT
ArrowLeftLEFT

Sample Code

const tvRtlRemoteKeys = {
ArrowUp: 'UP',
ArrowDown: 'DOWN',
ArrowRight: 'LEFT',
ArrowLeft: 'RIGHT',
Enter: 'OK',
Backspace: 'BACK',
38: 'UP',
40: 'DOWN',
39: 'LEFT',
37: 'RIGHT',
13: 'OK',
8: 'BACK',
10009: 'BACK',
461: 'BACK'
};
const tvRemoteKeys = {
ArrowUp: 'UP',
ArrowDown: 'DOWN',
ArrowRight: 'RIGHT',
ArrowLeft: 'LEFT',
Enter: 'OK',
Backspace: 'BACK',
Escape: 'BACK',
38: 'UP',
40: 'DOWN',
39: 'RIGHT',
37: 'LEFT',
13: 'OK',
8: 'BACK',
10009: 'BACK',
461: 'BACK'
};
function setupUI() {
const rtl = OneTrust.isRTLayout();
OneTrust.setRemoteKeys(rtl ? tvRtlRemoteKeys : tvRemoteKeys);
OneTrust.setupUI('self');
}