Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Search instead for 
Did you mean: 
Level 8

Localization: fixing and improving

This topic viewtopic.php?f=34&t=96416 draw my attention to there being some attempts of image localization in RSG URLs - but as reported, seems that is broken or not implemented. Fingers crossed it is not working as documented indeed, because i have a better proposal Smiley Happy

What is documented is an unnecessarily complicated, over-designed and yet limited and limiting process of looking up resources with URI starting with "pkg:/locale/". Shortfalls:

  1. It's is confusing for the developer (i had to do multiple passes reading the algorithm - others complained the same)

  2. Looky here, lookie there - it's like a shell game, just a "busy work" for the player to search multiple places

  3. Does not support "proper" URLs (e.g. "http://...") - and this is a BFD for an online device. What good is Roku's localization if i cannot reap benefits fetching localized images/audio/video from the Net?

  4. Unnecessarily restrictive on how directories should be organized (pkg:/locale/fr_CA/images/logo.jpg - why, what if i prefer pkg:/images/fr_CA/logo.jpg or pkg:/images/logo-fr_CA.jpg ?)

So, instead i propose something simpler, broader, faster - and overall more elegant, easier to comprehend: a macro! 

I did not invent the concept - and that's why it would be easier for the developers, they know it. Just have a literal like say $LCID if encountered in URIs, expanded to the current locale id and ... be done with the shell-game gallimaufry! That's all, folks. Then the player "magically"-yet-unsurprisingly will be able to get my resources from places like:
<Poster uri="pkg:/images/logo-$LCID.jpg" ...>
<Poster uri="$LCID/logo.jpg" ...>
<ContentNode url="$LCID.mp3"  ...>
<ContentNode streamformat="hls" url="$LCID/590226cd6c7b/ep_111_segment_1-cc_mix_033015.m3u8" ...>

In addition, let's improve  roLocalization - so that its method getLocalizedAsset(dirName, fileName) starts making some sense! My proposal is to allow (optional) template parameter in the constructor:
loc = CreateObject("roLocalization", "pkg:/images/locale=$LCID/$FILENAME")
>>> ? GetLocalizedAsset("", "MyImage-$LCID.png")
The template param being optional, if not provided it will be assumed (defaults to) "pkg:/locale/$LCID/$DIRNAME/$FILENAME" to maintain compatibility with current behavior. Note the example above is unnaturally contrived for the same of demonstrating double macro expansion.
0 Kudos