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.
Language | Example Script |
---|---|
Arabic | العربية |
Hebrew | עברית |
Persian | فارسی |
Urdu | اردو |
To enable RTL support
Public method isRTLayout()
isRTLayout()
Returns true
or false
.
Return Value | Action Required |
---|---|
true | Call OneTrust.setRemoteKeys() with the RTL key codes. |
false | Call OneTrust.setRemoteKeys() with the regular (LTR) key codes. |
OneTrust TV SDK Key Codes
RTL key codes
Key Code | Action |
---|---|
ArrowRight | LEFT |
ArrowLeft | RIGHT |
LTR key codes
Key Code | Action |
---|---|
ArrowRight | RIGHT |
ArrowLeft | LEFT |
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');
}
Updated about 13 hours ago