[fusion-trac] #245: We are stripping out the regional part of the locale, makes sv-SE becoming only sv

Fusion trac_fusion at osgeo.org
Mon Apr 20 04:29:51 EDT 2009


#245: We are stripping out the regional part of the locale, makes sv-SE becoming
only sv
------------------------+---------------------------------------------------
   Reporter:  mbeckman  |       Owner:  madair
       Type:  defect    |      Status:  new   
   Priority:  P2        |   Milestone:  Future
  Component:  Core      |     Version:  1.1.1 
   Severity:  Minor     |    Keywords:        
External_id:            |       State:  New   
    Browser:  All       |          Os:  All   
------------------------+---------------------------------------------------
 In fusion.js around line 1075 we strip out the regional part of the
 locale, so sv-SE becoming only sv. Since the Swedish localization of
 OpenlLayers is saved as sv-SE OpenlLayers won't find it and therefore use
 the standard language.

 We could do it the same way as they do it in OpenLayers so that we can use
 both short and long.

 setCode: function(code) {
         var lang;
         if(!code) {
             code = (OpenLayers.Util.getBrowserName() == "msie") ?
                 navigator.userLanguage : navigator.language;
         }
         var parts = code.split('-');
         parts[0] = parts[0].toLowerCase();
         if(typeof OpenLayers.Lang[parts[0]] == "object") {
             lang = parts[0];
         }

         // check for regional extensions
         if(parts[1]) {
             var testLang = parts[0] + '-' + parts[1].toUpperCase();
             if(typeof OpenLayers.Lang[testLang] == "object") {
                 lang = testLang;
             }
         }
         if(!lang) {
             OpenLayers.Console.warn(
                 'Failed to find OpenLayers.Lang.' + parts.join("-") +
                 ' dictionary, falling back to default language'
             );
             lang = OpenLayers.Lang.defaultCode;
         }

         OpenLayers.Lang.code = lang;
     }

 Then we could use the sv-SE translation of OpenLayers without
 modification.

-- 
Ticket URL: <http://trac.osgeo.org/fusion/ticket/245>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.


More information about the fusion-trac mailing list