OpenLayers OpenLayers

Ticket #109: i18n.patch

File i18n.patch, 55.2 kB (added by madair, 1 year ago)
  • examples/i18n.html

    old new  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
     2        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd"> 
     3<html xmlns="http://www.w3.org/1999/xhtml"> 
     4    <head> 
     5        <meta http-equiv=Content-Type content="text/html; charset=UTF-8">         
     6        <title>OpenLayers I18N Example</title> 
     7        <style type="text/css"> 
     8            body { 
     9                margin: 0 2em; 
     10                font-family: sans-serif; 
     11            } 
     12        </style> 
     13         
     14        <script src="../lib/OpenLayers.js" type="text/javascript"></script> 
     15        <script src="../lib/OpenLayers/Lang/en-CA.js" type="text/javascript"></script> 
     16        <script src="../lib/OpenLayers/Lang/fr.js" type="text/javascript"></script> 
     17         
     18        <script type="text/javascript"> 
     19         
     20        var myStrings = { 
     21          'en': { 
     22            myTest: 'spell color for me', 
     23            myTemplate: 'language code currently set to ${lang}' 
     24          }, 
     25          'en-CA': { 
     26            myTest: 'spell colour for me, eh', 
     27            myTemplate: 'language code currently set to ${lang}, eh' 
     28          }, 
     29          'fr': { 
     30            myTest: "c'est couleur en français", 
     31            myTemplate: 'code de langage est fixé à ${lang}' 
     32          } 
     33        } 
     34         
     35        function init() { 
     36            //this shows adding in application defined string files 
     37            for (var langCode in myStrings) { 
     38              if (OpenLayers.Lang[langCode]) { 
     39                OpenLayers.Util.extend(OpenLayers.Lang[langCode], myStrings[langCode]); 
     40              } 
     41            } 
     42             
     43            displayStrings(OpenLayers.String.langCode); 
     44        } 
     45         
     46        function displayStrings(langCode) { 
     47            OpenLayers.String.langCode = langCode; 
     48             
     49            clearTable(); 
     50            var header = addRow('lang code', OpenLayers.String.langCode); 
     51            header.style.fontStyle = 'italic'; 
     52             
     53            var key = 'test1'; 
     54            var i18nString = OpenLayers.String.translate(key); 
     55            addRow(key, i18nString); 
     56             
     57            key = 'test2'; 
     58            i18nString = OpenLayers.String.translate(key); 
     59            addRow(key, i18nString); 
     60             
     61            key = 'test3'; 
     62            i18nString = OpenLayers.String.translate(key,{'testArg1':'canada','testArg2':456}); 
     63            addRow(key, i18nString); 
     64 
     65            key = 'noKey'; 
     66            i18nString = OpenLayers.String.translate(key); 
     67            addRow(key, i18nString); 
     68             
     69            key = 'myTest'; 
     70            i18nString = OpenLayers.String.translate(key); 
     71            addRow(key, i18nString); 
     72             
     73            key = 'myTemplate'; 
     74            i18nString = OpenLayers.String.translate(key, {'lang':OpenLayers.String.langCode}); 
     75            addRow(key, i18nString); 
     76        } 
     77           
     78        function addRow(key, text) { 
     79            var outputTable = document.getElementById('egOutput'); 
     80            row = document.createElement('tr'); 
     81            td = document.createElement('td'); 
     82            td.innerHTML = key; 
     83            row.appendChild(td); 
     84            td = document.createElement('td'); 
     85            td.innerHTML = text; 
     86            row.appendChild(td); 
     87            outputTable.tBodies[0].appendChild(row); 
     88            return row; 
     89        } 
     90 
     91        function clearTable() { 
     92            var outputTable = document.getElementById('egOutput'); 
     93            outputTable.tBodies[0].innerHTML = ''; 
     94        } 
     95 
     96        window.onload = init; 
     97        </script> 
     98    </head> 
     99    <body> 
     100        <h3>OpenLayers I18N Example</h3> 
     101        <p>This example shows how OpenLayers handles internationalization of strings</p> 
     102        <p>Show strings in: 
     103        <a href='javascript:displayStrings("en")'>english</a>&nbsp; 
     104        <a href='javascript:displayStrings("en-CA")'>english - Canadian</a>&nbsp; 
     105        <a href='javascript:displayStrings("fr")'>french</a>&nbsp; 
     106        <a href='javascript:displayStrings("sw")'>swahili (undefined, should default to en)</a>&nbsp; 
     107        </p> 
     108        <table id='egOutput'> 
     109          <tr><th>key</th><th>result</th></tr> 
     110        </table> 
     111    </body> 
     112</html> 
  • lib/OpenLayers.js

    old new  
    201201            "OpenLayers/Layer/WFS.js", 
    202202            "OpenLayers/Control/MouseToolbar.js", 
    203203            "OpenLayers/Control/NavToolbar.js", 
    204             "OpenLayers/Control/EditingToolbar.js" 
     204            "OpenLayers/Control/EditingToolbar.js", 
     205            "OpenLayers/Lang/en.js" 
    205206        ); // etc. 
    206207 
    207208        var agent = navigator.userAgent; 
  • lib/OpenLayers/Ajax.js

    old new  
    3434* @param {} request 
    3535*/ 
    3636OpenLayers.nullHandler = function(request) { 
    37     alert("Unhandled request return " + request.statusText); 
     37    alert(OpenLayers.String.translate("unhandledRequest", {'statusText':request.statusText})); 
    3838}; 
    3939 
    4040/**  
  • lib/OpenLayers/BaseTypes.js

    old new  
    99 * @requires OpenLayers/BaseTypes/Pixel.js 
    1010 * @requires OpenLayers/BaseTypes/Bounds.js 
    1111 * @requires OpenLayers/BaseTypes/Element.js 
     12 * @requires OpenLayers/Lang/en.js 
    1213 */ 
    13  
    14 /** 
     14  
     15/**  
    1516 * Header: OpenLayers Base Types 
    1617 * OpenLayers custom string, number and function functions are described here. 
    1718 */ 
     
    2324 *********************/ 
    2425 
    2526OpenLayers.String = { 
     27    /**  
     28     * APIProperty: langCode 
     29     * {String}  Current language code to use in OpenLayers.  These codes follow 
     30     * the IETF recommendations at http://www.ietf.org/rfc/rfc3066.txt 
     31     * This value is initialized from the browser's language setting, but may be  
     32     * changed by the application. 
     33     **/ 
     34    langCode: (OpenLayers.Util.getBrowserName() == "msie") ? 
     35                  navigator.userLanguage:navigator.language, 
     36                   
     37    /**  
     38     * APIProperty: defaultLangCode 
     39     * {String} default language to use when a specific language can't be found 
     40     **/ 
     41    defaultLangCode: 'en', 
     42     
    2643    /** 
    2744     * APIFunction: OpenLayers.String.startsWith 
    2845     * Test whether a string starts with another string.  
     
    90107        } 
    91108        return camelizedString; 
    92109    }, 
    93  
     110     
    94111    /** 
     112     * APIMethod: OpenLayers.String.translate 
     113     * uses the key into a dictionary of values based on the current language string. 
     114     * 
     115     * Any number of additional arguments may be passed, in which case they 
     116     *  will be interpolated in the string template in order.  String templates in the 
     117     * dictionary can use {0}, {1}, etc. as placeholders to be substituted by the 
     118     * additional arguments. 
     119     *  
     120     * Parameters: 
     121     * key - {String} The key for an i18n string value in the dictionary 
     122     *  
     123     * Returns: 
     124     * {String} A internationalized string 
     125     */ 
     126    translate: function(key, context) { 
     127      var langCode = null; 
     128      var langParts = OpenLayers.String.langCode.split('-'); 
     129      langParts[0] = langParts[0].toLowerCase(); 
     130      //first check the language base code 
     131      if (OpenLayers.Lang[langParts[0]]) { 
     132        langCode = langParts[0]; 
     133      } 
     134      //now check for regional extensions 
     135      if (langParts[1] && langParts[1].length>0) { 
     136        testLang = langParts[0] + '-' + langParts[1].toUpperCase(); 
     137        if (OpenLayers.Lang[testLang]) { 
     138          langCode = testLang; 
     139        } 
     140      } 
     141      if (!langCode) { 
     142        var msg = 'failed to find ' +OpenLayers.String.langCode+ ' dictionary, falling back to default language'; 
     143        OpenLayers.Console.log(msg); 
     144        langCode = OpenLayers.String.defaultLangCode; 
     145      } 
     146       
     147      var dictionary = OpenLayers.Lang[langCode]; 
     148      var message = "NoMsgsFound"; 
     149      var msgValue = dictionary[key]; 
     150      if (!msgValue) { 
     151        // Message not found, fall back to message key 
     152        message = key; 
     153      } else { 
     154        // Message found; pick last one so user can override messages 
     155        message = msgValue; 
     156        if (context) { 
     157          message = this.format(message, context); 
     158        } 
     159      } 
     160      return message; 
     161    }, 
     162     
     163    /** 
    95164     * APIFunction: OpenLayers.String.format 
    96165     * Given a string with tokens in the form ${token}, return a string 
    97166     *     with tokens replaced with properties from the given context 
     
    129198 
    130199}; 
    131200 
     201/** 
     202 * Header: OpenLayers.Lang 
     203 * OpenLayers I18n string dictionary in various languages.   
     204 * Each language dictionary consists of a hash table with key/value pairs.  
     205 * See the directory lib/OpenLayers/Lang for examples. 
     206 *  
     207 * Default language is English, langcode='en'. 
     208 */ 
     209OpenLayers.Lang = {}; 
     210 
    132211if (!String.prototype.startsWith) { 
    133212    /** 
    134213     * APIMethod: String.startsWith 
     
    141220     * {Boolean} Whether or not this string starts with the string passed in. 
    142221     */ 
    143222    String.prototype.startsWith = function(sStart) { 
    144         OpenLayers.Console.warn( 
    145             "This method has been deprecated and will be removed in 3.0. " + 
    146             "Please use OpenLayers.String.startsWith instead" 
    147         ); 
     223        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     224                                {'newMethod':'OpenLayers.String.startsWith'})); 
    148225        return OpenLayers.String.startsWith(this, sStart); 
    149226    }; 
    150227} 
     
    161238     * {Boolean} Whether or not this string contains with the string passed in. 
    162239     */ 
    163240    String.prototype.contains = function(str) { 
    164         OpenLayers.Console.warn( 
    165             "This method has been deprecated and will be removed in 3.0. " + 
    166             "Please use OpenLayers.String.contains instead" 
    167         ); 
     241        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     242                                  {'newMethod':'OpenLayers.String.contains'})); 
    168243        return OpenLayers.String.contains(this, str); 
    169244    }; 
    170245} 
     
    179254     *          trailing spaces removed 
    180255     */ 
    181256    String.prototype.trim = function() { 
    182         OpenLayers.Console.warn( 
    183             "This method has been deprecated and will be removed in 3.0. " + 
    184             "Please use OpenLayers.String.trim instead" 
    185         ); 
     257        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     258                                      {'newMethod':'OpenLayers.String.trim'})); 
    186259        return OpenLayers.String.trim(this); 
    187260    }; 
    188261} 
     
    198271     * {String} The string, camelized 
    199272     */ 
    200273    String.prototype.camelize = function() { 
    201         OpenLayers.Console.warn( 
    202             "This method has been deprecated and will be removed in 3.0. " + 
    203             "Please use OpenLayers.String.camelize instead" 
    204         ); 
     274        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     275                                  {'newMethod':'OpenLayers.String.camelize'})); 
    205276        return OpenLayers.String.camelize(this); 
    206277    }; 
    207278} 
     
    315386     *           If null, 0, or negative value passed in, returns 0 
    316387     */ 
    317388    Number.prototype.limitSigDigs = function(sig) { 
    318         OpenLayers.Console.warn( 
    319             "This method has been deprecated and will be removed in 3.0. " + 
    320             "Please use OpenLayers.Number.limitSigDigs instead" 
    321         ); 
     389        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     390                              {'newMethod':'OpenLayers.String.limitSigDigs'})); 
    322391        return OpenLayers.Number.limitSigDigs(this, sig); 
    323392    }; 
    324393} 
     
    388457     *            argument. 
    389458     */ 
    390459    Function.prototype.bind = function() { 
    391         OpenLayers.Console.warn( 
    392             "This method has been deprecated and will be removed in 3.0. " + 
    393             "Please use OpenLayers.Function.bind instead" 
    394         ); 
     460        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     461                                {'newMethod':'OpenLayers.String.bind'})); 
    395462        // new function takes the same arguments with this function up front 
    396463        Array.prototype.unshift.apply(arguments, [this]); 
    397464        return OpenLayers.Function.bind.apply(null, arguments); 
     
    411478     * {Function} 
    412479     */ 
    413480    Function.prototype.bindAsEventListener = function(object) { 
    414         OpenLayers.Console.warn( 
    415             "This method has been deprecated and will be removed in 3.0. " + 
    416             "Please use OpenLayers.Function.bindAsEventListener instead" 
    417         ); 
     481        OpenLayers.Console.warn(OpenLayers.String.translate("methodDeprecated", 
     482                        {'newMethod':'OpenLayers.String.bindAsEventListener'})); 
    418483        return OpenLayers.Function.bindAsEventListener(this, object); 
    419484    }; 
    420485} 
  • lib/OpenLayers/BaseTypes/Bounds.js

    old new  
    232232     */ 
    233233    add:function(x, y) { 
    234234        if ( (x == null) || (y == null) ) { 
    235             var msg = "You must pass both x and y values to the add function."
     235            var msg = OpenLayers.String.translate("boundsAddError")
    236236            OpenLayers.Console.error(msg); 
    237237            return null; 
    238238        } 
  • lib/OpenLayers/BaseTypes/LonLat.js

    old new  
    8484     */ 
    8585    add:function(lon, lat) { 
    8686        if ( (lon == null) || (lat == null) ) { 
    87             var msg = "You must pass both lon and lat values " + 
    88                       "to the add function."; 
     87            var msg = OpenLayers.String.translate("lonlatAddError"); 
    8988            OpenLayers.Console.error(msg); 
    9089            return null; 
    9190        } 
  • lib/OpenLayers/BaseTypes/Pixel.js

    old new  
    9191     */ 
    9292    add:function(x, y) { 
    9393        if ( (x == null) || (y == null) ) { 
    94             var msg = "You must pass both x and y values to the add function."
     94            var msg = OpenLayers.String.translate("pixelAddError")
    9595            OpenLayers.Console.error(msg); 
    9696            return null; 
    9797        } 
  • lib/OpenLayers/Control/LayerSwitcher.js

    old new  
    504504 
    505505 
    506506        this.baseLbl = document.createElement("div"); 
    507         this.baseLbl.innerHTML = "<u>Base Layer</u>"
     507        this.baseLbl.innerHTML = OpenLayers.String.translate("baseLayer")
    508508        this.baseLbl.style.marginTop = "3px"; 
    509509        this.baseLbl.style.marginLeft = "3px"; 
    510510        this.baseLbl.style.marginBottom = "3px"; 
     
    517517                      
    518518 
    519519        this.dataLbl = document.createElement("div"); 
    520         this.dataLbl.innerHTML = "<u>Overlays</u>"
     520        this.dataLbl.innerHTML = OpenLayers.String.translate("overlays")
    521521        this.dataLbl.style.marginTop = "3px"; 
    522522        this.dataLbl.style.marginLeft = "3px"; 
    523523        this.dataLbl.style.marginBottom = "3px"; 
  • lib/OpenLayers/Control/OverviewMap.js

    old new  
    498498        // as the base layer for the main map.  This should be made more robust. 
    499499        if(this.map.units != 'degrees') { 
    500500            if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) { 
    501                 alert('The overview map only works when it is in the same projection as the main map'); 
     501                alert(OpenLayers.String.translate("sameProjection")); 
    502502            } 
    503503        } 
    504504        var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 
  • lib/OpenLayers/Control/Permalink.js

    old new  
    111111        if (!this.element) { 
    112112            this.div.className = this.displayClass; 
    113113            this.element = document.createElement("a"); 
    114             this.element.innerHTML = "Permalink"
     114            this.element.innerHTML = OpenLayers.String.translate("permalink")
    115115            this.element.href=""; 
    116116            this.div.appendChild(this.element); 
    117117        } 
  • lib/OpenLayers/Control/Scale.js

    old new  
    6868            scale = Math.round(scale); 
    6969        }     
    7070         
    71         this.element.innerHTML = "Scale = 1 : " + scale
     71        this.element.innerHTML = OpenLayers.String.translate("scale", {'scaleDenom':scale})
    7272    },  
    7373 
    7474    CLASS_NAME: "OpenLayers.Control.Scale" 
  • lib/OpenLayers/Format.js

    old new  
    6868     * Depends on the subclass 
    6969     */ 
    7070    read: function(data) { 
    71         alert("Read not implemented."); 
     71        alert(OpenLayers.String.translate("readNotImplemented")); 
    7272    }, 
    7373     
    7474    /** 
     
    8282     * {String} A string representation of the object. 
    8383     */ 
    8484    write: function(object) { 
    85         alert("Write not implemented."); 
     85        alert(OpenLayers.String.translate("writeNotImplemented")); 
    8686    }, 
    8787 
    8888    CLASS_NAME: "OpenLayers.Format" 
  • lib/OpenLayers/Format/GML.js

    old new  
    154154                                           this.internalProjection);  
    155155                    }                        
    156156                } else { 
    157                     OpenLayers.Console.error("Unsupported geometry type: " + 
    158                                              type); 
     157                    OpenLayers.Console.error(OpenLayers.String.translate( 
     158                                "unsupportedGeometryType", {'geomType':type})); 
    159159                } 
    160160                // stop looking for different geometry types 
    161161                break; 
  • lib/OpenLayers/Format/KML.js

    old new  
    580580                                           this.internalProjection);  
    581581                    }                        
    582582                } else { 
    583                     OpenLayers.Console.error("Unsupported geometry type: " + 
    584                                              type); 
     583                    OpenLayers.Console.error(OpenLayers.String.translate( 
     584                                "unsupportedGeometryType", {'geomType':type})); 
    585585                } 
    586586                // stop looking for different geometry types 
    587587                break; 
  • lib/OpenLayers/Format/WFS.js

    old new  
    129129     * feature - {<OpenLayers.Feature.Vector>}  
    130130     */ 
    131131    update: function(feature) { 
    132         if (!feature.fid) { alert("Can't update a feature for which there is no FID."); } 
     132        if (!feature.fid) { alert(OpenLayers.String.translate("noFID")); } 
    133133        var updateNode = this.createElementNS(this.wfsns, 'wfs:Update'); 
    134134        updateNode.setAttribute("typeName", this.layerName); 
    135135 
     
    186186     */ 
    187187    remove: function(feature) { 
    188188        if (!feature.fid) {  
    189             alert("Can't delete a feature for which there is no FID.");  
     189            alert(OpenLayers.String.translate("noFID"));  
    190190            return false;  
    191191        } 
    192192        var deleteNode = this.createElementNS(this.featureNS, 'wfs:Delete'); 
  • lib/OpenLayers/Lang/fr.js

    old new  
     1OpenLayers.Lang.fr = { 
     2'test1': 'ceci est un test', 
     3'test2': 'et une autre avec des accents: Ú.ééééé^çà', 
     4'test3': 'arg un: ${testArg1} arg deux: ${testArg2} ', 
     5'overlays': "&#60;u&#62;Couches de superposition&#60;&#47;u&#62;", 
     6'end': '' 
     7}; 
  • lib/OpenLayers/Lang/en.js

    old new  
     1OpenLayers.Lang.en = { 
     2'test1': 'this is a test', 
     3'test2': 'and another test', 
     4'test3': 'arg one: ${testArg1} arg two: ${testArg2}', 
     5'unhandledRequest': "Unhandled request return ${statusText}", 
     6'permalink': "Permalink", 
     7'overlays': "Overlays", 
     8'baseLayer': "Base Layer", 
     9'sameProjection': "The overview map only works when it is in the same projection as the main map", 
     10'readNotImplemented': "Read not implemented.", 
     11'writeNotImplemented': "Write not implemented.", 
     12'noFID': "Can't update a feature for which there is no FID.", 
     13'errorLoadingGML': "Error in loading GML file ${url}", 
     14'browserNotSupported': "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}", 
     15'componentShouldBe': "addFeatures : component should be an ${geomType}", 
     16'getFeatureError': "getFeatureFromEvent called on layer with no renderer. " + 
     17                   "This usually means you destroyed a layer, but not some handler which is associated with it.", 
     18'minZoomLevelError': "The minZoomLevel property is only intended for use " + 
     19                    "with the FixedZoomLevels-descendent layers. That this " + 
     20                    "wfs layer checks for minZoomLevel is a relic of the" + 
     21                    "past. We cannot, however, remove it without possibly " + 
     22                    "breaking OL based applications that may depend on it." + 
     23                    " Therefore we are deprecating it -- the minZoomLevel " + 
     24                    "check below will be removed at 3.0. Please instead " + 
     25                    "use min/max resolution setting as described here: " + 
     26                    "http://trac.openlayers.org/wiki/SettingZoomLevels", 
     27'commitSuccess': "WFS Transaction: SUCCESS ${response}", 
     28'commitFailed': "WFS Transaction: FAILED ${response}", 
     29'googleWarning': "The Google Layer was unable to load correctly.<br><br>" + 
     30                "To get rid of this message, select a new BaseLayer " + 
     31                "in the layer switcher in the upper-right corner.<br><br>" + 
     32                "Most likely, this is because the Google Maps library " + 
     33                "script was either not included, or does not contain the " + 
     34                "correct API key for your site.<br><br>" + 
     35                "Developers: For help getting this working correctly, " + 
     36                "<a href='http://trac.openlayers.org/wiki/Google' " + 
     37                "target='_blank'>click here</a>", 
     38'getLayerWarning': "The ${layerType} Layer was unable to load correctly.<br><br>" + 
     39                "To get rid of this message, select a new BaseLayer " + 
     40                "in the layer switcher in the upper-right corner.<br><br>" + 
     41                "Most likely, this is because the ${layerLib} library " + 
     42                "script was either not correctly included.<br><br>" + 
     43                "Developers: For help getting this working correctly, " + 
     44                "<a href='http://trac.openlayers.org/wiki/${layerLib}' " + 
     45                "target='_blank'>click here</a>", 
     46'scale': "Scale = 1 : ${scaleDenom}", 
     47'layerAlreadyAdded': "You tried to add the layer: ${layerName} to the map, but it has already been added", 
     48'reprojectDeprecated': "You are using the 'reproject' option " + 
     49                "on the ${layerName} layer. This option is deprecated: " + 
     50                "its use was designed to support displaying data over commercial " +  
     51                "basemaps, but that functionality should now be achieved by using " + 
     52                "Spherical Mercator support. More information is available from " + 
     53                "http://trac.openlayers.org/wiki/SphericalMercator.", 
     54'methodDeprecated': "This method has been deprecated and will be removed in 3.0. " + 
     55                "Please use ${newMethod} instead.", 
     56'boundsAddError': "You must pass both x and y values to the add function.", 
     57'lonlatAddError': "You must pass both lon and lat values to the add function.", 
     58'pixelAddError': "You must pass both x and y values to the add function.", 
     59'unsupportedGeometryType': "Unsupported geometry type: ${geomType}", 
     60'clearArrayDeprecated': "OpenLayers.Util.clearArray() is Deprecated." + 
     61                " Please use 'array.length = 0' instead.", 
     62'getArgsDeprecated': "The getArgs() function is deprecated and will be removed " + 
     63                "with the 3.0 version of OpenLayers. Please instead use " + 
     64                "OpenLayers.Util.getParameters().", 
     65'pagePositionFailed': "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 
     66                 
     67'end': '' 
     68}; 
  • lib/OpenLayers/Lang/en-CA.js

    old new  
     1OpenLayers.Lang['en-CA'] = { 
     2'test1': 'this is a test, eh', 
     3'test2': 'and another test, eh', 
     4'test3': 'arg one: ${testArg1} arg two: ${testArg2}, eh', 
     5'unhandledRequest': "Unhandled request return ${statusText}", 
     6'permalink': "Permalink", 
     7'overlays': "Overlays", 
     8'baseLayer': "Base Layer", 
     9'sameProjection': "The overview map only works when it is in the same projection as the main map", 
     10'readNotImplemented': "Read not implemented.", 
     11'writeNotImplemented': "Write not implemented.", 
     12'noFID': "Can't update a feature for which there is no FID.", 
     13'errorLoadingGML': "Error in loading GML file ${url}", 
     14'browserNotSupported': "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}", 
     15'componentShouldBe': "addFeatures : component should be an ${geomType}", 
     16'getFeatureError': "getFeatureFromEvent called on layer with no renderer. " + 
     17                   "This usually means you destroyed a layer, but not some handler which is associated with it.", 
     18'minZoomLevelError': "The minZoomLevel property is only intended for use " + 
     19                    "with the FixedZoomLevels-descendent layers. That this " + 
     20                    "wfs layer checks for minZoomLevel is a relic of the" + 
     21                    "past. We cannot, however, remove it without possibly " + 
     22                    "breaking OL based applications that may depend on it." + 
     23                    " Therefore we are deprecating it -- the minZoomLevel " + 
     24                    "check below will be removed at 3.0. Please instead " + 
     25                    "use min/max resolution setting as described here: " + 
     26                    "http://trac.openlayers.org/wiki/SettingZoomLevels", 
     27'commitSuccess': "WFS Transaction: SUCCESS ${response}", 
     28'commitFailed': "WFS Transaction: FAILED ${response}", 
     29'googleWarning': "The Google Layer was unable to load correctly.<br><br>" + 
     30                "To get rid of this message, select a new BaseLayer " + 
     31                "in the layer switcher in the upper-right corner.<br><br>" + 
     32                "Most likely, this is because the Google Maps library " + 
     33                "script was either not included, or does not contain the " + 
     34                "correct API key for your site.<br><br>" + 
     35                "Developers: For help getting this working correctly, " + 
     36                "<a href='http://trac.openlayers.org/wiki/Google' " + 
     37                "target='_blank'>click here</a>", 
     38'getLayerWarning': "The ${layerType} Layer was unable to load correctly.<br><br>" + 
     39                "To get rid of this message, select a new BaseLayer " + 
     40                "in the layer switcher in the upper-right corner.<br><br>" + 
     41                "Most likely, this is because the ${layerLib} library " + 
     42                "script was either not correctly included.<br><br>" + 
     43                "Developers: For help getting this working correctly, " + 
     44                "<a href='http://trac.openlayers.org/wiki/${layerLib}' " + 
     45                "target='_blank'>click here</a>", 
     46'scale': "Scale = 1 : ${scaleDenom}", 
     47'layerAlreadyAdded': "You tried to add the layer: ${layerName} to the map, but it has already been added", 
     48'reprojectDeprecated': "You are using the 'reproject' option " + 
     49                "on the ${layerName} layer. This option is deprecated: " + 
     50                "its use was designed to support displaying data over commercial " +  
     51                "basemaps, but that functionality should now be achieved by using " + 
     52                "Spherical Mercator support. More information is available from " + 
     53                "http://trac.openlayers.org/wiki/SphericalMercator.", 
     54'methodDeprecated': "This method has been deprecated and will be removed in 3.0. " + 
     55                "Please use ${newMethod} instead.", 
     56'boundsAddError': "You must pass both x and y values to the add function.", 
     57'lonlatAddError': "You must pass both lon and lat values to the add function.", 
     58'pixelAddError': "You must pass both x and y values to the add function.", 
     59'unsupportedGeometryType': "Unsupported geometry type: ${geomType}", 
     60'clearArrayDeprecated': "OpenLayers.Util.clearArray() is Deprecated." + 
     61                " Please use 'array.length = 0' instead.", 
     62'getArgsDeprecated': "The getArgs() function is deprecated and will be removed " + 
     63                "with the 3.0 version of OpenLayers. Please instead use " + 
     64                "OpenLayers.Util.getParameters().", 
     65'pagePositionFailed': "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 
     66                 
     67'end': '' 
     68}; 
  • lib/OpenLayers/Lang/en-CA.js

    old new  
     1OpenLayers.Lang['en-CA'] = { 
     2'test1': 'this is a test, eh', 
     3'test2': 'and another test, eh', 
     4'test3': 'arg one: ${testArg1} arg two: ${testArg2}, eh', 
     5'unhandledRequest': "Unhandled request return ${statusText}", 
     6'permalink': "Permalink", 
     7'overlays': "Overlays", 
     8'baseLayer': "Base Layer", 
     9'sameProjection': "The overview map only works when it is in the same projection as the main map", 
     10'readNotImplemented': "Read not implemented.", 
     11'writeNotImplemented': "Write not implemented.", 
     12'noFID': "Can't update a feature for which there is no FID.", 
     13'errorLoadingGML': "Error in loading GML file ${url}", 
     14'browserNotSupported': "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}", 
     15'componentShouldBe': "addFeatures : component should be an ${geomType}", 
     16'getFeatureError': "getFeatureFromEvent called on layer with no renderer. " + 
     17                   "This usually means you destroyed a layer, but not some handler which is associated with it.", 
     18'minZoomLevelError': "The minZoomLevel property is only intended for use " + 
     19                    "with the FixedZoomLevels-descendent layers. That this " + 
     20                    "wfs layer checks for minZoomLevel is a relic of the" + 
     21                    "past. We cannot, however, remove it without possibly " + 
     22                    "breaking OL based applications that may depend on it." + 
     23                    " Therefore we are deprecating it -- the minZoomLevel " + 
     24                    "check below will be removed at 3.0. Please instead " + 
     25                    "use min/max resolution setting as described here: " + 
     26                    "http://trac.openlayers.org/wiki/SettingZoomLevels", 
     27'commitSuccess': "WFS Transaction: SUCCESS ${response}", 
     28'commitFailed': "WFS Transaction: FAILED ${response}", 
     29'googleWarning': "The Google Layer was unable to load correctly.<br><br>" + 
     30                "To get rid of this message, select a new BaseLayer " + 
     31                "in the layer switcher in the upper-right corner.<br><br>" + 
     32                "Most likely, this is because the Google Maps library " + 
     33                "script was either not included, or does not contain the " + 
     34                "correct API key for your site.<br><br>" + 
     35                "Developers: For help getting this working correctly, " + 
     36                "<a href='http://trac.openlayers.org/wiki/Google' " + 
     37                "target='_blank'>click here</a>", 
     38'getLayerWarning': "The ${layerType} Layer was unable to load correctly.<br><br>" + 
     39                "To get rid of this message, select a new BaseLayer " + 
     40                "in the layer switcher in the upper-right corner.<br><br>" + 
     41                "Most likely, this is because the ${layerLib} library " + 
     42                "script was either not correctly included.<br><br>" + 
     43                "Developers: For help getting this working correctly, " + 
     44                "<a href='http://trac.openlayers.org/wiki/${layerLib}' " + 
     45                "target='_blank'>click here</a>", 
     46'scale': "Scale = 1 : ${scaleDenom}", 
     47'layerAlreadyAdded': "You tried to add the layer: ${layerName} to the map, but it has already been added", 
     48'reprojectDeprecated': "You are using the 'reproject' option " + 
     49                "on the ${layerName} layer. This option is deprecated: " + 
     50                "its use was designed to support displaying data over commercial " +  
     51                "basemaps, but that functionality should now be achieved by using " + 
     52                "Spherical Mercator support. More information is available from " + 
     53                "http://trac.openlayers.org/wiki/SphericalMercator.", 
     54'methodDeprecated': "This method has been deprecated and will be removed in 3.0. " + 
     55                "Please use ${newMethod} instead.", 
     56'boundsAddError': "You must pass both x and y values to the add function.", 
     57'lonlatAddError': "You must pass both lon and lat values to the add function.", 
     58'pixelAddError': "You must pass both x and y values to the add function.", 
     59'unsupportedGeometryType': "Unsupported geometry type: ${geomType}", 
     60'clearArrayDeprecated': "OpenLayers.Util.clearArray() is Deprecated." + 
     61                " Please use 'array.length = 0' instead.", 
     62'getArgsDeprecated': "The getArgs() function is deprecated and will be removed " + 
     63                "with the 3.0 version of OpenLayers. Please instead use " + 
     64                "OpenLayers.Util.getParameters().", 
     65'pagePositionFailed': "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 
     66                 
     67'end': '' 
     68}; 
  • lib/OpenLayers/Lang/en.js

    old new  
     1OpenLayers.Lang.en = { 
     2'test1': 'this is a test', 
     3'test2': 'and another test', 
     4'test3': 'arg one: ${testArg1} arg two: ${testArg2}', 
     5'unhandledRequest': "Unhandled request return ${statusText}", 
     6'permalink': "Permalink", 
     7'overlays': "Overlays", 
     8'baseLayer': "Base Layer", 
     9'sameProjection': "The overview map only works when it is in the same projection as the main map", 
     10'readNotImplemented': "Read not implemented.", 
     11'writeNotImplemented': "Write not implemented.", 
     12'noFID': "Can't update a feature for which there is no FID.", 
     13'errorLoadingGML': "Error in loading GML file ${url}", 
     14'browserNotSupported': "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}", 
     15'componentShouldBe': "addFeatures : component should be an ${geomType}", 
     16'getFeatureError': "getFeatureFromEvent called on layer with no renderer. " + 
     17                   "This usually means you destroyed a layer, but not some handler which is associated with it.", 
     18'minZoomLevelError': "The minZoomLevel property is only intended for use " + 
     19                    "with the FixedZoomLevels-descendent layers. That this " + 
     20                    "wfs layer checks for minZoomLevel is a relic of the" + 
     21                    "past. We cannot, however, remove it without possibly " + 
     22                    "breaking OL based applications that may depend on it." + 
     23                    " Therefore we are deprecating it -- the minZoomLevel " + 
     24                    "check below will be removed at 3.0. Please instead " + 
     25                    "use min/max resolution setting as described here: " + 
     26                    "http://trac.openlayers.org/wiki/SettingZoomLevels", 
     27'commitSuccess': "WFS Transaction: SUCCESS ${response}", 
     28'commitFailed': "WFS Transaction: FAILED ${response}", 
     29'googleWarning': "The Google Layer was unable to load correctly.<br><br>" + 
     30                "To get rid of this message, select a new BaseLayer " + 
     31                "in the layer switcher in the upper-right corner.<br><br>" + 
     32                "Most likely, this is because the Google Maps library " + 
     33                "script was either not included, or does not contain the " + 
     34                "correct API key for your site.<br><br>" + 
     35                "Developers: For help getting this working correctly, " + 
     36                "<a href='http://trac.openlayers.org/wiki/Google' " + 
     37                "target='_blank'>click here</a>", 
     38'getLayerWarning': "The ${layerType} Layer was unable to load correctly.<br><br>" + 
     39                "To get rid of this message, select a new BaseLayer " + 
     40                "in the layer switcher in the upper-right corner.<br><br>" + 
     41                "Most likely, this is because the ${layerLib} library " + 
     42                "script was either not correctly included.<br><br>" + 
     43                "Developers: For help getting this working correctly, " + 
     44                "<a href='http://trac.openlayers.org/wiki/${layerLib}' " + 
     45                "target='_blank'>click here</a>", 
     46'scale': "Scale = 1 : ${scaleDenom}", 
     47'layerAlreadyAdded': "You tried to add the layer: ${layerName} to the map, but it has already been added", 
     48'reprojectDeprecated': "You are using the 'reproject' option " + 
     49                "on the ${layerName} layer. This option is deprecated: " + 
     50                "its use was designed to support displaying data over commercial " +  
     51                "basemaps, but that functionality should now be achieved by using " + 
     52                "Spherical Mercator support. More information is available from " + 
     53                "http://trac.openlayers.org/wiki/SphericalMercator.", 
     54'methodDeprecated': "This method has been deprecated and will be removed in 3.0. " + 
     55                "Please use ${newMethod} instead.", 
     56'boundsAddError': "You must pass both x and y values to the add function.", 
     57'lonlatAddError': "You must pass both lon and lat values to the add function.", 
     58'pixelAddError': "You must pass both x and y values to the add function.", 
     59'unsupportedGeometryType': "Unsupported geometry type: ${geomType}", 
     60'clearArrayDeprecated': "OpenLayers.Util.clearArray() is Deprecated." + 
     61                " Please use 'array.length = 0' instead.", 
     62'getArgsDeprecated': "The getArgs() function is deprecated and will be removed " + 
     63                "with the 3.0 version of OpenLayers. Please instead use " + 
     64                "OpenLayers.Util.getParameters().", 
     65'pagePositionFailed': "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 
     66                 
     67'end': '' 
     68}; 
  • lib/OpenLayers/Lang/fr.js

    old new  
     1OpenLayers.Lang.fr = { 
     2'test1': 'ceci est un test', 
     3'test2': 'et une autre avec des accents: Ú.ééééé^çà', 
     4'test3': 'arg un: ${testArg1} arg deux: ${testArg2} ', 
     5'overlays': "&#60;u&#62;Couches de superposition&#60;&#47;u&#62;", 
     6'end': '' 
     7}; 
  • lib/OpenLayers/Layer/GML.js

    old new  
    157157     * request - {String}  
    158158     */ 
    159159    requestFailure: function(request) { 
    160         alert("Error in loading GML file "+this.url); 
     160        alert(OpenLayers.String.translate("errorLoadingGML", {'url':this.url})); 
    161161        this.events.triggerEvent("loadend"); 
    162162    }, 
    163163 
  • lib/OpenLayers/Layer/Google.js

    old new  
    309309     *          it working. 
    310310     */ 
    311311    getWarningHTML:function() { 
    312  
    313         var html = ""; 
    314         html += "The Google Layer was unable to load correctly.<br>"; 
    315         html += "<br>"; 
    316         html += "To get rid of this message, select a new BaseLayer "; 
    317         html += "in the layer switcher in the upper-right corner.<br>"; 
    318         html += "<br>"; 
    319         html += "Most likely, this is because the Google Maps library"; 
    320         html += " script was either not included, or does not contain the"; 
    321         html += " correct API key for your site.<br>"; 
    322         html += "<br>"; 
    323         html += "Developers: For help getting this working correctly, "; 
    324         html += "<a href='http://trac.openlayers.org/wiki/Google' "; 
    325         html +=  "target='_blank'>"; 
    326         html +=     "click here"; 
    327         html += "</a>"; 
    328          
    329         return html; 
     312        return OpenLayers.String.translate("googleWarning"); 
    330313    }, 
    331314 
    332315 
  • lib/OpenLayers/Layer/MultiMap.js

    old new  
    9797     *          it working. 
    9898     */ 
    9999    getWarningHTML:function() { 
    100  
    101         var html = ""; 
    102         html += "The MM Layer was unable to load correctly.<br>"; 
    103         html += "<br>"; 
    104         html += "To get rid of this message, select a new BaseLayer "; 
    105         html += "in the layer switcher in the upper-right corner.<br>"; 
    106         html += "<br>"; 
    107         html += "Most likely, this is because the MM library"; 
    108         html += " script was either not correctly included.<br>"; 
    109         html += "<br>"; 
    110         html += "Demmlopers: For help getting this working correctly, "; 
    111         html += "<a href='http://trac.openlayers.org/wiki/MultiMap' "; 
    112         html +=  "target='_blank'>"; 
    113         html +=     "click here"; 
    114         html += "</a>"; 
    115  
    116         return html; 
     100        return OpenLayers.String.translate("getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"}); 
    117101    }, 
    118102 
    119103 
  • lib/OpenLayers/Layer/Vector.js

    old new  
    214214     */ 
    215215    displayError: function() { 
    216216        if (this.reportError) { 
    217             var message = "Your browser does not support vector rendering. " +  
    218                             "Currently supported renderers are:\n"; 
    219             message += this.renderers.join("\n"); 
    220             alert(message); 
     217            alert(OpenLayers.String.translate("browserNotSupported",  
     218                                     {'renderers':this.renderers.join("\n")})); 
    221219        }     
    222220    }, 
    223221 
     
    309307            var feature = features[i]; 
    310308             
    311309            if (this.geometryType && 
    312                 !(feature.geometry instanceof this.geometryType)) { 
    313                     var throwStr = "addFeatures : component should be an " +  
    314                                     this.geometryType.prototype.CLASS_NAME
    315                     throw throwStr; 
    316                
     310              !(feature.geometry insta