Forum Discussion

movingtarget's avatar
11 years ago

roLocalization problem

Can someone please explain what's wrong here:


BrightScript Debugger> p loc
<Component: roLocalization>
BrightScript Debugger> p loc.GetPluralString
Syntax Error. (runtime error &h02) in $LIVECOMPILE(8)
BrightScript Debugger> p loc.GetLocalizedAsset
Syntax Error. (runtime error &h02) in $LIVECOMPILE(9)


I'm using roLocalization object which should be supported (http://sdkdocs.roku.com/pages/viewpage. ... Id=3114060), and is in fact created. But the ifLocalization interface appears to not exist. How can I fix this? I'm on 5.5.
  • You're trying to print the results of a method without any parameters or parentheses, which is resulting in a syntax error.
  • Hm, yeah - BrightScript is funky like that. Depending on your language background, you may expect `obj.method` (no params) to either call the method (Ruby?) or to return a bound method function (Python):
    >>> f = 'abcdefgh'.find
    >>> f
    <built-in method find of str object at 0x2b9620>
    >>> f('d')
    3

    But it doesn't - and can't blame it for it, because BRS is a different language. I suspect there was a complication in implementing this, so instead a runtime error is thrown (notice how this is not the usual flavor of "Syntax Error. (compile error &h02)").
  • I was trying to show a sample... But if you insist - this doesn't work either:


    BrightScript Debugger> loc = CreateObject("roLocalization")
    BrightScript Debugger> p loc
    <Component: roLocalization>
    BrightScript Debugger> p loc.GetPluralString(2, "1 something", "^n somethings")
    Member function not found in BrightScript Component or interface. (runtime error &hf4) in $LIVECOMPILE(9)
  • Looks like there was an error in the GetPluralString documentation. It should take 4 parameters. I've corrected it here.

    --Mark