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: 
TechTalk01
Binge Watcher

String localization in Channel

I want to perform localization for my channel from English to Spanish Mexican,

for that I had written translations.xml file as..

Screenshot 2023-09-05 143040.jpg
 
and in brs file I am creating a label named ..
 
  m.display_content1 = m.top.findNode("display_content1")
  m.display_content1.text = tr("Everything you like in one place!")
 
I had placed the translations.xml file in 
 

Screenshot 2023-09-05 142722.jpg

 Still in output I am getting "Everything you like in one place!" as output instead of text in Transalations.xml file.
Can anyone please help in resolve this issue. ?
0 Kudos
3 REPLIES 3
renojim
Community Streaming Expert

Re: String localization in Channel

I haven't used string localization, so I probably shouldn't be trying to answer and I'll apologize in advance if the following seems obvious, but what to you get from ifDeviceInfo GetCurrentLocale()?  It will only translate if the current locale is "es_MX" as far as I can tell.

https://developer.roku.com/docs/developer-program/core-concepts/localization.md

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
TechTalk01
Binge Watcher

Re: String localization in Channel

Hi @renojim 

 ifDeviceInfo GetCurrentLocale() will return the current Language code of device,

 

Like in device language setting if you change language to English it will return en_US if you change it to espanol for me it is showing es_MX i.e Mexican Spanish.

0 Kudos
renojim
Community Streaming Expert

Re: String localization in Channel

Ok, just checking that you're actually getting "es_MX" back when you're expecting tr() to return the translated text.  Hopefully someone that's used it will chime in.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.