[Building Sakai] Null locale in english

Jesus Federico jesus at blindsidenetworks.com
Tue Sep 4 07:00:47 PDT 2012


Sorry Steve, I replied directly instead of foing it to the list.

Jesus


--------------


I don't think it has anything to do with i18n. The value that the servlet
sends to the client is directly retrieved from the ResourceLoader, see:

        url.append("&language=").append(sakaiProxy.getUserLanguageCode());

...
public String getUserLanguageCode()
{
Locale locale = (new ResourceLoader()).getLocale();
 return locale.toString();
}

The issue is that the language code generated by the ResourceLoader is a
null that it goes to the javascript in the client as a blank.


When jquery.i18n.properties, the library used by the bbb-tool to handle
localization, receives that blank (or a null, it doesn't matter) the
default value taken is the one the browser has.

see:
 * @param  language (string, optional) language/country code (eg, 'en',
'en_US', 'pt_PT'). if not specified, language reported by the browser will
be used instead.

    if(settings.language === null || settings.language == '') {
   settings.language = $.i18n.browserLang();
 }
if(settings.language === null) {settings.language='';}


That is why Daniel is getting the Spanish localization. Not because the
Tomcat defaults but because the browser defaults.

But the question is, why the ResourceLoader is returning null for his
case?. I tested out the tool and I did some inspect on the values returned
using 2.8.2 and 2.7 and I didn't experience any problem. The language code
is going to the client as it is supposed to.

Jesus Federico





On Thu, Aug 30, 2012 at 10:19 PM, Steve Swinsburg <steve.swinsburg at gmail.com
> wrote:

> Hi Daniel
>
> I wonder if you could run some tests in other tools that use different
> display technologies like profile2 which uses wicket and maybe polls which
> uses RSF. The bbb tool is trim path I think so  there may be an issue with
> the various i18n methods, or it may be in the resource loader.
>
> Cheers
> Steve
>
> Sent from my iPhone
>
> On 30/08/2012, at 22:59, Daniel Merino <daniel.merino at unavarra.es> wrote:
>
> > Hi everybody.
> >
> > A few days ago, I wrote to the list about an ResourceLoader issue. I
> > thought that it was a single tool's issue (bbb-tool) but it seems that
> > it relates to the kernel-util package.
> >
> > On Sakai 2.7.1 with Kernel 1.1.13, I have edited the kernel-util's
> > ResourceLoader.java class and I have added this line in the getLocale()
> > method:
> >
> > public Locale getLocale()
> > {
> >    (...)
> >    System.out.println("RETURNED LOCALE: "+loc.toString());
> >
> >    return loc;
> > }
> >
> >
> > When I use any language (i.e. "fr_FR" or "es_ES"), the right code is
> > returned in Tomcat's logs, but when I choose en_US, en_UK or en, a null
> > locale is returned. It seems that all the tools show default properties
> > when they get a null locale, so they work fine because default
> > properties are in english, but bbb-tool doesn't do this and shows
> > Tomcat's language properties (spanish, in this case).
> >
> > Changing Tomcat's language to english language works fine for bbb-tool,
> > but I would like to solve this without changing that. I would like that,
> > if I choose en_US in preferences, locale could be en_US.
> >
> > I'm working with CentOS 5.8 with server language LANG=es_ES.UTF-8
> >
> > Any idea?
> >
> > Thanks in advance.
> > Best regards.
> > --
> > Daniel Merino Echeverría
> > daniel.merino at unavarra.es
> > Gestor de teleformación - Centro Superior de Innovación Educativa.
> > Tfno: 948-168489 - Universidad Pública de Navarra.
> > _______________________________________________
> > sakai-dev mailing list
> > sakai-dev at collab.sakaiproject.org
> > http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> >
> > TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>



-- 
<http://www.blindsidenetworks.com/>

*Jesus Federico*
Software Engineer, Blindside Networks Inc.

(    +1 (613) 695-0264
*    jesus at blindsidenetworks.com
skype: jesus.federico





-- 
<http://www.blindsidenetworks.com/>

*Jesus Federico*
Software Engineer, Blindside Networks Inc.

(    +1 (613) 695-0264
*    jesus at blindsidenetworks.com
skype: jesus.federico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120904/d6ef343b/attachment.html 


More information about the sakai-dev mailing list