Also, I think you have your localization functions backwards:
cfg[osapi.container.ContainerConfig.GET_COUNTRY] = function() {return
'cn';}
cfg[osapi.container.ContainerConfig.GET_LANGUAGE] = function() {return
'zh';}
The locale is cn-zh, not zh-cn.
From: Dan Dumont/Westford/IBM@Lotus
To: [email protected],
Date: 11/18/2011 09:26 AM
Subject: Re: gadget i18n questions
The attributes on your locale look wrong.
Here's a sample from one of my localization gadgets:
<ModulePrefs title="TestOSGadget" author_email="[email protected]"
description="This is a test!">
<Locale messages="../i18n/ALL-ALL.xml"/>
<Locale lang="ar" messages="../i18n/ar-ALL.xml" language_direction="rtl"
/>
<Locale lang="en" messages="../i18n/en-ALL.xml"/>
<Locale lang="en" country="us" messages="../i18n/en-us.xml"/>
<Locale lang="de" messages="../i18n/de-ALL.xml"/>
<Locale lang="ja" messages="../i18n/ja-ALL.xml"/>
<Locale lang="ko" messages="../i18n/ko-ALL.xml"/>
<Locale lang="pt" messages="../i18n/pt-ALL.xml"/>
<Locale lang="pt" country="br" messages="../i18n/pt-BR.xml"/>
<Locale lang="ru" messages="../i18n/ru-ALL.xml"/>
You shouldn't have to reference another html file, but note the lang and
country attrs
From: Wei CSDL Shi <[email protected]>
To: [email protected],
Date: 11/17/2011 10:39 PM
Subject: Re: gadget i18n questions
I tried to set the GET_COUNTRY and GET_LANGUAGE in my container, the
metadata request already contains the county and lanague I set, but it
still can't show that language when rendering the gadget.
Here is how I set them into my container as a testing purpose:
cfg[osapi.container.ContainerConfig.GET_COUNTRY] = function() {return
'cn';}
cfg[osapi.container.ContainerConfig.GET_LANGUAGE] = function() {return
'zh';}
var cc = new osapi.container.Container(cfg);
I can't find direct info about how to make it work. Anybody have any
experience on this gadget feature?
Thanks
Best Regards
Marshall Shi(Shi Wei)
"Ryan J Baxter" ---2011-11-18 07:16:08---I think you probably need to set
the GET_COUNTRY and GET_LANGUAGE
"Ryan J Baxter" <[email protected]>
2011-11-18 07:11
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: gadget i18n questions
I think you probably need to set the GET_COUNTRY and GET_LANGUAGE
parameters in the container config so the container knows the country and
language preferences, although I have not tried this myself. These
parameters get passed in the metadata request which I assume would then
return the IFR URL with the correct country and language parameters set.
-Ryan
Email: [email protected]
Phone: 978-899-3041
developerWorks Profile
From: Wei CSDL Shi <[email protected]>
To: shindig <[email protected]>,
Date: 11/17/2011 02:42 AM
Subject: gadget i18n questions
I am trying to use the multi language feature of gadget. Unfortunately I
have no luck to make it work when I switch my browser language.
Here is my test gadget:
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="SampleGadgetWithScope">
<Require feature="opensocial-i18n"></Require>
<Locale lang="all">
<msg name="hello_world">Hello World.</msg>
</Locale>
<Locale lang="de">
<msg name="hello_world">Hola Mundo.</msg>
</Locale>
<Locale lang="zh-cn">
<msg name="hello_world">你好世界.</msg>
</Locale>
</ModulePrefs>
<Content type="html">
<![CDATA[
<div id="__MODULE_ID__gadget">
<b>__MSG_hello_world__</b>
<h3>
<span>blabla</span>
</h3>
</div>
]]>
</Content>
</Module>
In the common container, I tried to load feature "opensocial-i18n" as
well,
but the "zh-cn" and "de" message never show up when I switch my browser
locale.
Can anyone point me out what I am doing wrong here? I searched for a while
but I can't find any direct help on this topic. I would propose to add a
i18n sample page in shindig build.
Thanks
Best Regards
Marshall Shi(Shi Wei)