我正在尝试为OpenSocial应用程序添加多语言支持。我看到我可以在小工具XML标记中链接到我自己的消息包:

<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>

但我如何从中提取值?

有帮助吗?

解决方案

要提取值,您应使用 getMsg 方法

var prefs = new gadgets.Prefs();
var msg = prefs.getMsg('hello_world');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top