Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
savasdenli
Newbie

Right-to-left (RTL) Languages Support

Hi everyone. Now i am developing a Roku Channel with Arabic Language. Is there anyway of use Arabic language?

For now i'm using a StringReverse function to convert from ltr to rtl. And using an arabic font for letters shown correctly. It texts are not shown correctly.
For example "Comedy" must be shown as "كوميديا"
But it is shown like that "ك وم ي د يا" Without spaces but shown letter by letter inspite of words (In arabic when letters become to words they must be adjacent).
Note: In Youtube application there isn't this problem. Arabic words are shown correctly.

Thanks a lot.
11 REPLIES 11
24i
Streaming Star

Re: Right-to-left (RTL) Languages Support

Hi savasdenli,

Do you have any luck on solving this?
We are currently developing an application that has to support Arabic languages and we are facing the same problem now.
What do you do in the StringReverse function, as I take it it's something you created yourself?
0 Kudos
savasdenli
Newbie

Re: Right-to-left (RTL) Languages Support

"24i" wrote:
Hi savasdenli,

Do you have any luck on solving this?
We are currently developing an application that has to support Arabic languages and we are facing the same problem now.
What do you do in the StringReverse function, as I take it it's something you created yourself?

I used this function but it is not enough. 
function stringReverse(input as String) as String
   newStr = ""
   len = len(input)

   for i = len to 1 step -1
      newStr = newStr + mid(input, i, 1)
   end for

   return newStr
end function
0 Kudos
24i
Streaming Star

Re: Right-to-left (RTL) Languages Support

Ah I see, thanks anyway!
We made contact with Roku about this problem, they are looking into the problem with the engineering team. 
Let's hope they can give us something to work with.
0 Kudos
destruk
Binge Watcher

Re: Right-to-left (RTL) Languages Support

Without seeing the actual test display, source text and resulting full text, I can simply suggest - assuming that there is a space between each letter and two or three spaces between words now in the resulting produced output -
A) run your routine as you have it now
B) take the resulting returned string of arabic text and replace two or three consecutive spaces into an unused or uncommon character like *
C) take the result of that operation and replace single spaces with nothing -- ie replace " " with ""
D) take the result of that operation and replace your uncommon substituted character with a single space.

It's a little more work, but if Roku fixes the original problem then you can remove this adjustment, and if they don't then you are good to go.

If it is a display problem, you can check the length of the resulting string and compare it to the length of the source string.
Print LEN(sourcetext)

And for scenegraph, if the string lengths are the same you could put each character into it's own label field for display, and line up the labels with pixel accuracy for display overlapping them if needed to remove the gaps as required for manual display.

Does the source string display with spaces between letters before you reverse the character order?
0 Kudos
rftvaa
Visitor

Re: Right-to-left (RTL) Languages Support

We gave up on the RTL support because we also went with the StringReverse alternative but it became a huge challenge when we had to support multiline labels. In case that is also a requirement in your channel, you should start considering how are you going to support it as soon as possible. I can share our attempts on that later if you need.
0 Kudos
savasdenli
Newbie

Re: Right-to-left (RTL) Languages Support

"destruk" wrote:
Without seeing the actual test display, source text and resulting full text, I can simply suggest - assuming that there is a space between each letter and two or three spaces between words now in the resulting produced output -
A) run your routine as you have it now
B) take the resulting returned string of arabic text and replace two or three consecutive spaces into an unused or uncommon character like *
C) take the result of that operation and replace single spaces with nothing -- ie replace " " with ""
D) take the result of that operation and replace your uncommon substituted character with a single space.

It's a little more work, but if Roku fixes the original problem then you can remove this adjustment, and if they don't then you are good to go.

If it is a display problem, you can check the length of the resulting string and compare it to the length of the source string.
Print LEN(sourcetext)

And for scenegraph, if the string lengths are the same you could put each character into it's own label field for display, and line up the labels with pixel accuracy for display overlapping them if needed to remove the gaps as required for manual display.

Does the source string display with spaces between letters before you reverse the character order?

Thanks for your reply but the problem is not about spaces. If you look the letters in word "كو " when two letters written without spaces the form of letters must be change like this.

"ك و " if you remove space between this two letter it must be like that  "كو ". In browser it has been automatically. But in roku it doesn't became.

I want to help about this. Only in Youtube Channel this problem has not been occured and shown correctly.
0 Kudos
24i
Streaming Star

Re: Right-to-left (RTL) Languages Support

We gave up on RTL support as well (for now at least). 
We had contact with Roku about this and currently those language are not supported and won't be supported in the near future. 
As savasdenli said, it's not just about the spaces. Other problems you run into is having a keyboard that supports the characters, inputfields and subtitles to which you can't set a different font, rows not starting on the right, etc.
0 Kudos
govinds
Visitor

Re: Right-to-left (RTL) Languages Support

"rftvaa" wrote:
We gave up on the RTL support because we also went with the StringReverse alternative but it became a huge challenge when we had to support multiline labels. In case that is also a requirement in your channel, you should start considering how are you going to support it as soon as possible. I can share our attempts on that later if you need.


could you share what you did to solve this? Trying to support RTL on Roku for mutiline labels is becoming so frustrating. Anybody got any good solutions for this?
0 Kudos
speechles
Roku Guru

Re: Right-to-left (RTL) Languages Support

"govinds" wrote:
"rftvaa" wrote:
We gave up on the RTL support because we also went with the StringReverse alternative but it became a huge challenge when we had to support multiline labels. In case that is also a requirement in your channel, you should start considering how are you going to support it as soon as possible. I can share our attempts on that later if you need.


could you share what you did to solve this? Trying to support RTL on Roku for mutiline labels is becoming so frustrating. Anybody got any good solutions for this?

You said "good solution" so maybe this isn't that. "A solution" is to assume how many characters will fit a label regardless of screen real estate. Then assign 10 labels. Each of those labels number 1 through 10. Now each of those in itself is its own label its own line. You no longer do multi-line as you must now do this in a function using each of your 10 labels or however many you need do span lines onto. You may not need all 10 of these labels for your lines. They are there if you do. You would also have to deal with handling translation placements if this wasn't within say a layout group.

Lets assume it is bound by a layout group that would handle align all the labels and eliminate needing any translation placements in the labels at all and still keep everything lined up nicely. You would probably need to write this as a component that extends the label node. Then use it to create a fake multi-line label using multiple labels. You reference it back by the layout group which would include the child nodes of the labels. Doing the math for all this to figure the right amount of characters to assume for the width of your labels would take some magic math equation. You might be able to use GetOneLineWidth() to more accurately tell when to chop the lines you feed to the labels and get pretty close to actually copy what multi-line labels do to begin with. You can't chop on bytes you have to chop on characters so hopefully the Roku can do this correctly using instr(index,$text," ") and index is the amount of characters you assume can fit the line if you can't get the GetOneLineWidth() to work with your custom fonts that work with any language such as Googles Noto. We could never make GetOneLineWidth() work reliably with right to left and string reverse. Maybe you can? Otherwise abandon it and instead count characters and assume a width-per-char to apply. You might always cut too soon but you can get it baby bear/goldilocks close. Where it is close enough for the government type of thing.

But like others said the rows don't start on the right. Scrolling doesn't start on the right. You would have to roll-your-own components for all of these too that over-ride the default behavior. Extend the component and then customize it. There may be more shortcomings to this that I do not see as I have not fully attempted this yet. It is possible though but you must go through effort to get there. Roku does not make any of this easy when you work outside their supported language set. You go off the map so to speak and have to forge your own roads.

It might also be possible to use a labellist and get the same effect as multiple labels without the limitation that wrap="true" imposes on labels? You need to try labellist and feed it cut lines as the list. This might also be possible and less math since you wouldn't need to track which label of the 10 to add data. You just append to the one labellist.

function stringReverse(input as String) as String
   newStr = ""
   for each char in input.split("")
      newStr = char + newStr
   end for
   return newStr
end function
0 Kudos