Localization in OpenSocial gadget app
-
03-07-2019 - |
Question
I'm trying to add multi-language support to an OpenSocial application. I see that I can link to my own message bundles in the gadget XML markup:
<Module>
<ModulePrefs title="Hello" description="Message bundle demo">
<Require feature="opensocial-0.7"/>
<Locale lang="en" messages="http://example.com/hello/en_ALL.xml"/>
</ModulePrefs>
. . .
</Module>
But how do I actually extract values from them?
Solution
To extract the values you should use the getMsg method
var prefs = new gadgets.Prefs();
var msg = prefs.getMsg('hello_world');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow