[mapguide-users] Getting locale from URL instead of from Browser in Fusion

GreenMapSanMiguel webmaster at SMAmap.com
Mon Dec 28 14:18:52 EST 2009



Just spent some time stepping through code to further isolate the problem. 
It turns out that initializeLocale is called several times.  Calls from the
bootstrap routine and initialize both correctly pick up the locale (es) from
the URL allowing OpenLayers.i18n to work correctly.

The final call to initializeLocale is from createSessionCB in
fusion/layers/MapGuide/MapGuide.js requsts that Fusion.locale be set to the
browser language.  Widgets used after the maps is loaded get the browser
language (en) instead of the URL locale (es)

I can work around this by simply commenting out that last call to
initializeLocale but, since I don't really understand what this routine is
for, perhaps this is not a great idea:

    createSessionCB: function(xhr) {
        if (xhr.status == 200) {
            var o;
            eval('o='+xhr.responseText);
            this.session[0] = o.sessionId;
            var acceptLang = o.acceptLanguage.split(',');
            //IE - en-ca,en-us;q=0.8,fr;q=0.5,fr-ca;q=0.3
            for (var i=0; i<acceptLang.length; ++i) {
              var locale = acceptLang[i].split(";");
              // removed to preserve URL locale
              // Fusion.initializeLocale(locale[0]);
              break;
            }
            this.triggerEvent(Fusion.Event.MAP_SESSION_CREATED);
        }
    },

We're having some internet problems in Mexico right now but once it is
stable enough, I'll open a ticket on this (unjless someone thinks it is
working as desired.)

Thanks!

Andy Baltimore
-- 
View this message in context: http://n2.nabble.com/Getting-locale-from-URL-instead-of-from-Browser-in-Fusion-tp4224424p4224836.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list