You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Karsten Beyer <ma...@kbeyer.net> on 2008/06/06 11:37:16 UTC

GadgetRenderer(PHP) ignores locale information in iframe url

Hi,
it seems that the GadgetRenderer ignores the parameters "country" and "lang"
that are put into the iframe URL by for example partuza. I am not sure what
the OpenSocial specification has to tell about this, but i think that the
container should have preference regarding the language settings (e.g. if
the SNS has some settings for the language of the user, this setting should
take preference over the ACCEPT LANGUAGE ) of the browser.

Example URL:

http://shindig.kbsilver/gadgets/ifr?synd=default&container=default&viewer=4&owner=5&aid=33&mid=71&country=US&lang=EN.
..


The ACCEPT LANGUAGE could be used as a fallback in case the container did
not set it. Also:


["HTTP_ACCEPT_LANGUAGE"]=>

  string(35) "en,de;q=0.8,nl-be;q=0.5,fr-be;q=0.3"


(Firefox 2.0.0.14 on Mac OS X)


The code in GadgetContext->instanceLocale will not detect this correctly:


$acceptLanguage = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);

   $acceptLanguage = $acceptLanguage[0];

   if (strpos($acceptLanguage, '-') !== false) {


Are there any plans to support matching multiple locales in the future? e.g.


HTTP_ACCEPT_LANGUAGE = de-DE, fr-FR, en-US


would mean that German is prefered. But if it is not there, French should
first be looked for.


A possible solution would be that the GadgetContext stores an array of
locales. In the first position the one from the iframe URL, followed by the
ones from the ACCEPT_LANGUAGE header. The GadgetServer should then traverse
this array and pick the first one that is supported by the Gadget. If there
was no match, the locales should be tested with country = ALL. If there is
still no match, all-ALL should be used.


Best Regards


Karsten Beyer

Re: GadgetRenderer(PHP) ignores locale information in iframe url

Posted by Chris Chabot <ch...@xs4all.nl>.
Good catch!

Could you please file a JIRA issue for this in
https://issues.apache.org/jira/secure/BrowseProject.jspa?id=12310741 ?

I'll get on fixing this asap.

	-- Chris

On Fri, 2008-06-06 at 11:37 +0200, Karsten Beyer wrote:
> Hi,
> it seems that the GadgetRenderer ignores the parameters "country" and "lang"
> that are put into the iframe URL by for example partuza. I am not sure what
> the OpenSocial specification has to tell about this, but i think that the
> container should have preference regarding the language settings (e.g. if
> the SNS has some settings for the language of the user, this setting should
> take preference over the ACCEPT LANGUAGE ) of the browser.
> 
> Example URL:
> 
> http://shindig.kbsilver/gadgets/ifr?synd=default&container=default&viewer=4&owner=5&aid=33&mid=71&country=US〈=EN.
> ..
> 
> 
> The ACCEPT LANGUAGE could be used as a fallback in case the container did
> not set it. Also:
> 
> 
> ["HTTP_ACCEPT_LANGUAGE"]=>
> 
>   string(35) "en,de;q=0.8,nl-be;q=0.5,fr-be;q=0.3"
> 
> 
> (Firefox 2.0.0.14 on Mac OS X)
> 
> 
> The code in GadgetContext->instanceLocale will not detect this correctly:
> 
> 
> $acceptLanguage = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
> 
>    $acceptLanguage = $acceptLanguage[0];
> 
>    if (strpos($acceptLanguage, '-') !== false) {
> 
> 
> Are there any plans to support matching multiple locales in the future? e.g.
> 
> 
> HTTP_ACCEPT_LANGUAGE = de-DE, fr-FR, en-US
> 
> 
> would mean that German is prefered. But if it is not there, French should
> first be looked for.
> 
> 
> A possible solution would be that the GadgetContext stores an array of
> locales. In the first position the one from the iframe URL, followed by the
> ones from the ACCEPT_LANGUAGE header. The GadgetServer should then traverse
> this array and pick the first one that is supported by the Gadget. If there
> was no match, the locales should be tested with country = ALL. If there is
> still no match, all-ALL should be used.
> 
> 
> Best Regards
> 
> 
> Karsten Beyer