Ticket #109: i18n.2.patch
| File i18n.2.patch, 41.0 kB (added by tschaub, 11 months ago) |
|---|
-
tests/test_Lang.html
old new 1 <html> 2 <head> 3 <script src="../lib/OpenLayers.js"></script> 4 <script src="../lib/OpenLayers/Lang/en-CA.js" type="text/javascript"></script> 5 <script src="../lib/OpenLayers/Lang/fr.js" type="text/javascript"></script> 6 <script type="text/javascript"> 7 8 function test_setCode(t) { 9 t.plan(4); 10 OpenLayers.Lang.code = null; 11 12 // test with no argument - this could result in the default or the 13 // browser language if a dictionary exists 14 OpenLayers.Lang.setCode(); 15 t.ok(OpenLayers.Lang.code != null, 16 "code set when no argument is sent"); 17 18 var primary = "xx"; 19 var subtag = "XX"; 20 var code = primary + "-" + subtag; 21 OpenLayers.Lang[code] = {}; 22 23 // test code for dictionary that exists 24 OpenLayers.Lang.setCode(code); 25 t.eq(OpenLayers.Lang.code, code, 26 "code properly set for existing dictionary"); 27 28 // test code for dictionary that doesn't exist 29 OpenLayers.Lang.setCode(primary + "-YY"); 30 t.eq(OpenLayers.Lang.code, OpenLayers.Lang.defaultCode, 31 "code set to default for non-existing dictionary"); 32 33 // test code for existing primary but missing subtag 34 OpenLayers.Lang[primary] = {}; 35 OpenLayers.Lang.setCode(primary + "-YY"); 36 t.eq(OpenLayers.Lang.code, primary, 37 "code set to primary when subtag dictionary is missing"); 38 39 // clean up 40 delete OpenLayers.Lang[code]; 41 delete OpenLayers.Lang[primary]; 42 OpenLayers.Lang.code = null; 43 } 44 45 function test_getCode(t) { 46 t.plan(3); 47 OpenLayers.Lang.code = null; 48 49 // test that a non-null value is retrieved - could be browser language 50 // or defaultCode 51 var code = OpenLayers.Lang.getCode(); 52 t.ok(code != null, "returns a non-null code"); 53 t.ok(OpenLayers.Lang.code != null, "sets the code to a non-null value"); 54 55 // test that the code is returned if non-null 56 OpenLayers.Lang.code = "foo"; 57 t.eq(OpenLayers.Lang.getCode(), "foo", "returns the code if non-null"); 58 59 // clean up 60 OpenLayers.Lang.code = null; 61 } 62 63 function test_i18n(t) { 64 t.plan(1); 65 t.ok(OpenLayers.i18n === OpenLayers.Lang.translate, 66 "i18n is an alias for OpenLayers.Lang.translate"); 67 } 68 69 function test_translate(t) { 70 var keys = ['test1', 'test3', 'noKey']; 71 var codes = ['en', 'en-CA', 'fr', 'fr-CA', 'sw']; 72 var result = { 73 'en': {'overlays':'Overlays', 74 'unhandledRequest':'Unhandled request return foo', 75 'noKey':'noKey'}, 76 'en-CA': {'overlays':'Overlays', 77 'unhandledRequest':'Unhandled request return foo', 78 'noKey':'noKey'}, 79 'fr': {'overlays':'Couches de superposition', 80 'unhandledRequest':'unhandledRequest', // not translated 81 'noKey':'noKey'}, 82 'fr-CA': {'overlays':'Couches de superposition', //this should result in 'fr' 83 'unhandledRequest':'unhandledRequest', // not translated 84 'noKey':'noKey'}, 85 'sw': {'overlays':'Overlays', //this should result in 'en' 86 'unhandledRequest':'Unhandled request return foo', 87 'noKey':'noKey'} 88 }; 89 90 t.plan(keys.length*codes.length); 91 92 for (var i=0; i<codes.length; ++i) { 93 var code = codes[i]; 94 OpenLayers.Lang.setCode(code); 95 t.eq(OpenLayers.Lang.translate('overlays'), result[code]['overlays'], "simple key lookup in "+code); 96 t.eq(OpenLayers.Lang.translate('unhandledRequest',{'statusText':'foo'}), 97 result[code]['unhandledRequest'], "lookup with argument substitution in "+code); 98 t.eq(OpenLayers.Lang.translate('noKey'), result[code]['noKey'], "invalid key returns the key in "+code); 99 } 100 } 101 102 </script> 103 </head> 104 <body> 105 </body> 106 </html> -
tests/list-tests.html
old new 49 49 <li>Rule/test_Logical.html</li> 50 50 <li>test_Events.html</li> 51 51 <li>test_Util.html</li> 52 <li>test_Lang.html</li> 52 53 <li>test_Layer.html</li> 53 54 <li>test_Renderer.html</li> 54 55 <li>Layer/test_EventPane.html</li> -
lib/OpenLayers/Lang/fr.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Lang.js 7 */ 8 9 /** 10 * Namespace: OpenLayers.Lang["fr"] 11 * Dictionary for French. Keys for entries are used in calls to 12 * <OpenLayers.Lang.translate>. Entry bodies are normal strings or 13 * strings formatted for use with <OpenLayers.String.format> calls. 14 */ 15 OpenLayers.Lang.fr = { 16 17 'overlays': "Couches de superposition" 18 19 }; -
lib/OpenLayers/Lang/en.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Lang.js 7 */ 8 9 /** 10 * Namespace: OpenLayers.Lang["en"] 11 * Dictionary for English. Keys for entries are used in calls to 12 * <OpenLayers.Lang.translate>. Entry bodies are normal strings or 13 * strings formatted for use with <OpenLayers.String.format> calls. 14 */ 15 OpenLayers.Lang.en = { 16 17 'unhandledRequest': "Unhandled request return ${statusText}", 18 19 'permalink': "Permalink", 20 21 'overlays': "Overlays", 22 23 'baseLayer': "Base Layer", 24 25 'sameProjection': 26 "The overview map only works when it is in the same projection as the main map", 27 28 'readNotImplemented': "Read not implemented.", 29 30 'writeNotImplemented': "Write not implemented.", 31 32 'noFID': "Can't update a feature for which there is no FID.", 33 34 'errorLoadingGML': "Error in loading GML file ${url}", 35 36 'browserNotSupported': 37 "Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}", 38 39 'componentShouldBe': "addFeatures : component should be an ${geomType}", 40 41 'getFeatureError': 42 "getFeatureFromEvent called on layer with no renderer. This usually means you " + 43 "destroyed a layer, but not some handler which is associated with it.", 44 45 'minZoomLevelError': 46 "The minZoomLevel property is only intended for use " + 47 "with the FixedZoomLevels-descendent layers. That this " + 48 "wfs layer checks for minZoomLevel is a relic of the" + 49 "past. We cannot, however, remove it without possibly " + 50 "breaking OL based applications that may depend on it." + 51 " Therefore we are deprecating it -- the minZoomLevel " + 52 "check below will be removed at 3.0. Please instead " + 53 "use min/max resolution setting as described here: " + 54 "http://trac.openlayers.org/wiki/SettingZoomLevels", 55 56 'commitSuccess': "WFS Transaction: SUCCESS ${response}", 57 58 'commitFailed': "WFS Transaction: FAILED ${response}", 59 60 'googleWarning': 61 "The Google Layer was unable to load correctly.<br><br>" + 62 "To get rid of this message, select a new BaseLayer " + 63 "in the layer switcher in the upper-right corner.<br><br>" + 64 "Most likely, this is because the Google Maps library " + 65 "script was either not included, or does not contain the " + 66 "correct API key for your site.<br><br>" + 67 "Developers: For help getting this working correctly, " + 68 "<a href='http://trac.openlayers.org/wiki/Google' " + 69 "target='_blank'>click here</a>", 70 71 'getLayerWarning': 72 "The ${layerType} Layer was unable to load correctly.<br><br>" + 73 "To get rid of this message, select a new BaseLayer " + 74 "in the layer switcher in the upper-right corner.<br><br>" + 75 "Most likely, this is because the ${layerLib} library " + 76 "script was either not correctly included.<br><br>" + 77 "Developers: For help getting this working correctly, " + 78 "<a href='http://trac.openlayers.org/wiki/${layerLib}' " + 79 "target='_blank'>click here</a>", 80 81 'scale': "Scale = 1 : ${scaleDenom}", 82 83 'layerAlreadyAdded': 84 "You tried to add the layer: ${layerName} to the map, but it has already been added", 85 86 'reprojectDeprecated': 87 "You are using the 'reproject' option " + 88 "on the ${layerName} layer. This option is deprecated: " + 89 "its use was designed to support displaying data over commercial " + 90 "basemaps, but that functionality should now be achieved by using " + 91 "Spherical Mercator support. More information is available from " + 92 "http://trac.openlayers.org/wiki/SphericalMercator.", 93 94 'methodDeprecated': 95 "This method has been deprecated and will be removed in 3.0. " + 96 "Please use ${newMethod} instead.", 97 98 'boundsAddError': "You must pass both x and y values to the add function.", 99 100 'lonlatAddError': "You must pass both lon and lat values to the add function.", 101 102 'pixelAddError': "You must pass both x and y values to the add function.", 103 104 'unsupportedGeometryType': "Unsupported geometry type: ${geomType}", 105 106 'pagePositionFailed': 107 "OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.", 108 109 'end': '' 110 }; -
lib/OpenLayers/Lang/en-CA.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 /** 6 * @requires OpenLayers/Lang/en.js 7 */ 8 9 /** 10 * Namespace: OpenLayers.Lang["en-CA"] 11 * Dictionary for English-CA. This dictionary inherits from the standard 12 * English dictionary. Override only those entries with language specific 13 * to the CA region. 14 * 15 * Keys for entries are used in calls to <OpenLayers.Lang.translate>. Entry 16 * bodies are normal strings or strings formatted for use with 17 * <OpenLayers.String.format> calls. 18 */ 19 OpenLayers.Lang['en-CA'] = OpenLayers.Util.applyDefaults({ 20 21 // add any entries specific for this region here 22 // e.g. 23 // "someKey": "Some regionally specific value" 24 25 }, OpenLayers.Lang["en"]); -
lib/OpenLayers/Format/GML.js
old new 154 154 this.internalProjection); 155 155 } 156 156 } else { 157 OpenLayers.Console.error( "Unsupported geometry type: " +158 type);157 OpenLayers.Console.error(OpenLayers.i18n( 158 "unsupportedGeometryType", {'geomType':type})); 159 159 } 160 160 // stop looking for different geometry types 161 161 break; -
lib/OpenLayers/Format/WFS.js
old new 129 129 * feature - {<OpenLayers.Feature.Vector>} 130 130 */ 131 131 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.i18n("noFID")); } 133 133 var updateNode = this.createElementNS(this.wfsns, 'wfs:Update'); 134 134 updateNode.setAttribute("typeName", this.layerName); 135 135 … … 186 186 */ 187 187 remove: function(feature) { 188 188 if (!feature.fid) { 189 alert( "Can't delete a feature for which there is no FID.");189 alert(OpenLayers.i18n("noFID")); 190 190 return false; 191 191 } 192 192 var deleteNode = this.createElementNS(this.featureNS, 'wfs:Delete'); -
lib/OpenLayers/Format/KML.js
old new 580 580 this.internalProjection); 581 581 } 582 582 } else { 583 OpenLayers.Console.error( "Unsupported geometry type: " +584 type);583 OpenLayers.Console.error(OpenLayers.i18n( 584 "unsupportedGeometryType", {'geomType':type})); 585 585 } 586 586 // stop looking for different geometry types 587 587 break; -
lib/OpenLayers/Map.js
old new 726 726 addLayer: function (layer) { 727 727 for(var i=0; i < this.layers.length; i++) { 728 728 if (this.layers[i] == layer) { 729 var msg = "You tried to add the layer: " + layer.name +730 " to the map, but it has already been added";729 var msg = OpenLayers.i18n('layerAlreadyAdded', 730 {'layerName':layer.name}); 731 731 OpenLayers.Console.warn(msg); 732 732 return false; 733 733 } -
lib/OpenLayers/Lang.js
old new 1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 * full text of the license. */ 4 5 6 /** 7 * Namespace: OpenLayers.Lang 8 * Internationalization namespace. Contains dictionaries in various languages 9 * and methods to set and get the current language. 10 */ 11 OpenLayers.Lang = { 12 13 /** 14 * Property: code 15 * {String} Current language code to use in OpenLayers. Use the 16 * <setCode> method to set this value and the <getCode> method to 17 * retrieve it. 18 */ 19 code: null, 20 21 /** 22 * APIProperty: defaultCode 23 * {String} Default language to use when a specific language can't be 24 * found. Default is "en". 25 */ 26 defaultCode: "en", 27 28 /** 29 * APIFunction: getCode 30 * Get the current language code. 31 * 32 * Returns: 33 * The current language code. 34 */ 35 getCode: function() { 36 if(!OpenLayers.Lang.code) { 37 OpenLayers.Lang.setCode(); 38 } 39 return OpenLayers.Lang.code; 40 }, 41 42 /** 43 * APIFunction: setCode 44 * Set the language code for string translation. This code is used by 45 * the <OpenLayers.Lang.translate> method. 46 * 47 * Parameters- 48 * code - {String} These codes follow the IETF recommendations at 49 * http://www.ietf.org/rfc/rfc3066.txt. If no value is set, the 50 * browser's language setting will be tested. If no <OpenLayers.Lang> 51 * dictionary exists for the code, the <OpenLayers.String.defaultLang> 52 * will be used. 53 */ 54 setCode: function(code) { 55 var lang; 56 if(!code) { 57 code = (OpenLayers.Util.getBrowserName() == "msie") ? 58 navigator.userLanguage : navigator.language; 59 } 60 var parts = code.split('-'); 61 parts[0] = parts[0].toLowerCase(); 62 if(typeof OpenLayers.Lang[parts[0]] == "object") { 63 lang = parts[0]; 64 } 65 66 // check for regional extensions 67 if(parts[1]) { 68 var testLang = parts[0] + '-' + parts[1].toUpperCase(); 69 if(typeof OpenLayers.Lang[testLang] == "object") { 70 lang = testLang; 71 } 72 } 73 if(!lang) { 74 OpenLayers.Console.warn( 75 'Failed to find OpenLayers.Lang.' + parts.join("-") + 76 ' dictionary, falling back to default language' 77 ); 78 lang = OpenLayers.Lang.defaultCode 79 } 80 81 OpenLayers.Lang.code = lang; 82 }, 83 84 /** 85 * APIMethod: translate 86 * Looks up a key from a dictionary based on the current language string. 87 * The value of <getCode> will be used to determine the appropriate 88 * dictionary. Dictionaries are stored in <OpenLayers.Lang>. 89 * 90 * Parameters: 91 * key - {String} The key for an i18n string value in the dictionary. 92 * context - {Object} Optional context to be used with 93 * <OpenLayers.String.format>. 94 * 95 * Returns: 96 * {String} A internationalized string. 97 */ 98 translate: function(key, context) { 99 var dictionary = OpenLayers.Lang[OpenLayers.Lang.getCode()]; 100 var message = dictionary[key]; 101 if(!message) { 102 // Message not found, fall back to message key 103 message = key; 104 } 105 if(context) { 106 message = OpenLayers.String.format(message, context); 107 } 108 return message; 109 } 110 111 }; 112 113 114 /** 115 * APIMethod: OpenLayers.i18n 116 * Alias for <OpenLayers.Lang.translate>. Looks up a key from a dictionary 117 * based on the current language string. The value of 118 * <OpenLayers.Lang.getCode> will be used to determine the appropriate 119 * dictionary. Dictionaries are stored in <OpenLayers.Lang>. 120 * 121 * Parameters: 122 * key - {String} The key for an i18n string value in the dictionary. 123 * context - {Object} Optional context to be used with 124 * <OpenLayers.String.format>. 125 * 126 * Returns: 127 * {String} A internationalized string. 128 */ 129 OpenLayers.i18n = OpenLayers.Lang.translate; -
lib/OpenLayers/Ajax.js
old new 34 34 * @param {} request 35 35 */ 36 36 OpenLayers.nullHandler = function(request) { 37 alert( "Unhandled request return " + request.statusText);37 alert(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText})); 38 38 }; 39 39 40 40 /** -
lib/OpenLayers/BaseTypes/LonLat.js
old new 84 84 */ 85 85 add:function(lon, lat) { 86 86 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.i18n("lonlatAddError"); 89 88 OpenLayers.Console.error(msg); 90 89 return null; 91 90 } -
lib/OpenLayers/BaseTypes/Bounds.js
old new 232 232 */ 233 233 add:function(x, y) { 234 234 if ( (x == null) || (y == null) ) { 235 var msg = "You must pass both x and y values to the add function.";235 var msg = OpenLayers.i18n("boundsAddError"); 236 236 OpenLayers.Console.error(msg); 237 237 return null; 238 238 } -
lib/OpenLayers/BaseTypes/Pixel.js
old new 91 91 */ 92 92 add:function(x, y) { 93 93 if ( (x == null) || (y == null) ) { 94 var msg = "You must pass both x and y values to the add function.";94 var msg = OpenLayers.i18n("pixelAddError"); 95 95 OpenLayers.Console.error(msg); 96 96 return null; 97 97 } -
lib/OpenLayers/Tile.js
old new 213 213 * bounds - {<OpenLayers.Bounds>} 214 214 */ 215 215 getBoundsFromBaseLayer: function(position) { 216 OpenLayers.Console.warn("You are using the 'reproject' option " + 217 "on the " + this.layer.name + " layer. This option is deprecated: " + 218 "its use was designed to support displaying data over commercial " + 219 "basemaps, but that functionality should now be achieved by using " + 220 "Spherical Mercator support. More information is available from " + 221 "http://trac.openlayers.org/wiki/SphericalMercator."); 216 var msg = OpenLayers.i18n('reprojectDeprecated', 217 {'layerName':this.layer.name}); 218 OpenLayers.Console.warn(msg); 222 219 var topLeft = this.layer.map.getLonLatFromLayerPx(position); 223 220 var bottomRightPx = position.clone(); 224 221 bottomRightPx.x += this.size.w; -
lib/OpenLayers/BaseTypes.js
old new 9 9 * @requires OpenLayers/BaseTypes/Pixel.js 10 10 * @requires OpenLayers/BaseTypes/Bounds.js 11 11 * @requires OpenLayers/BaseTypes/Element.js 12 * @requires OpenLayers/Lang/en.js 12 13 */ 13 14 /** 14 15 /** 15 16 * Header: OpenLayers Base Types 16 17 * OpenLayers custom string, number and function functions are described here. 17 18 */ … … 23 24 *********************/ 24 25 25 26 OpenLayers.String = { 27 26 28 /** 27 29 * APIFunction: OpenLayers.String.startsWith 28 30 * Test whether a string starts with another string. … … 90 92 } 91 93 return camelizedString; 92 94 }, 93 95 94 96 /** 95 97 * APIFunction: OpenLayers.String.format 96 98 * Given a string with tokens in the form ${token}, return a string … … 141 143 * {Boolean} Whether or not this string starts with the string passed in. 142 144 */ 143 145 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 ); 146 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 147 {'newMethod':'OpenLayers.String.startsWith'})); 148 148 return OpenLayers.String.startsWith(this, sStart); 149 149 }; 150 150 } … … 161 161 * {Boolean} Whether or not this string contains with the string passed in. 162 162 */ 163 163 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 ); 164 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 165 {'newMethod':'OpenLayers.String.contains'})); 168 166 return OpenLayers.String.contains(this, str); 169 167 }; 170 168 } … … 179 177 * trailing spaces removed 180 178 */ 181 179 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 ); 180 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 181 {'newMethod':'OpenLayers.String.trim'})); 186 182 return OpenLayers.String.trim(this); 187 183 }; 188 184 } … … 198 194 * {String} The string, camelized 199 195 */ 200 196 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 ); 197 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 198 {'newMethod':'OpenLayers.String.camelize'})); 205 199 return OpenLayers.String.camelize(this); 206 200 }; 207 201 } … … 315 309 * If null, 0, or negative value passed in, returns 0 316 310 */ 317 311 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 ); 312 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 313 {'newMethod':'OpenLayers.String.limitSigDigs'})); 322 314 return OpenLayers.Number.limitSigDigs(this, sig); 323 315 }; 324 316 } … … 388 380 * argument. 389 381 */ 390 382 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 ); 383 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 384 {'newMethod':'OpenLayers.String.bind'})); 395 385 // new function takes the same arguments with this function up front 396 386 Array.prototype.unshift.apply(arguments, [this]); 397 387 return OpenLayers.Function.bind.apply(null, arguments); … … 411 401 * {Function} 412 402 */ 413 403 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 ); 404 OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated", 405 {'newMethod':'OpenLayers.String.bindAsEventListener'})); 418 406 return OpenLayers.Function.bindAsEventListener(this, object); 419 407 }; 420 408 } -
lib/OpenLayers/Control/OverviewMap.js
old new 498 498 // as the base layer for the main map. This should be made more robust. 499 499 if(this.map.units != 'degrees') { 500 500 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.i18n("sameProjection")); 502 502 } 503 503 } 504 504 var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); -
lib/OpenLayers/Control/Permalink.js
old new 111 111 if (!this.element) { 112 112 this.div.className = this.displayClass; 113 113 this.element = document.createElement("a"); 114 this.element.innerHTML = "Permalink";114 this.element.innerHTML = OpenLayers.i18n("permalink"); 115 115 this.element.href=""; 116 116 this.div.appendChild(this.element); 117 117 } -
lib/OpenLayers/Control/LayerSwitcher.js
old new 504 504 505 505 506 506 this.baseLbl = document.createElement("div"); 507 this.baseLbl.innerHTML = "<u>Base Layer</u>";507 this.baseLbl.innerHTML = OpenLayers.i18n("baseLayer"); 508 508 this.baseLbl.style.marginTop = "3px"; 509 509 this.baseLbl.style.marginLeft = "3px"; 510 510 this.baseLbl.style.marginBottom = "3px"; … … 517 517 518 518 519 519 this.dataLbl = document.createElement("div"); 520 this.dataLbl.innerHTML = "<u>Overlays</u>";520 this.dataLbl.innerHTML = OpenLayers.i18n("overlays"); 521 521 this.dataLbl.style.marginTop = "3px"; 522 522 this.dataLbl.style.marginLeft = "3px"; 523 523 this.dataLbl.style.marginBottom = "3px"; -
lib/OpenLayers/Control/Scale.js
old new 68 68 scale = Math.round(scale); 69 69 } 70 70 71 this.element.innerHTML = "Scale = 1 : " + scale;71 this.element.innerHTML = OpenLayers.i18n("scale", {'scaleDenom':scale}); 72 72 }, 73 73 74 74 CLASS_NAME: "OpenLayers.Control.Scale" -
lib/OpenLayers/Util.js
old new 100 100 * array - {Array} 101 101 */ 102 102 OpenLayers.Util.clearArray = function(array) { 103 var msg = "OpenLayers.Util.clearArray() is Deprecated." + 104 " Please use 'array.length = 0' instead."; 105 OpenLayers.Console.warn(msg); 103 OpenLayers.Console.warn( 104 OpenLayers.i18n( 105 "methodDeprecated", {'newMethod': 'array = []'} 106 ) 107 ); 106 108 array.length = 0; 107 109 }; 108 110 … … 866 868 * {Object} An object of key/value pairs from the query string. 867 869 */ 868 870 OpenLayers.Util.getArgs = function(url) { 869 var err = "The getArgs() function is deprecated and will be removed " + 870 "with the 3.0 version of OpenLayers. Please instead use " + 871 "OpenLayers.Util.getParameters()."; 872 OpenLayers.Console.warn(err); 871 OpenLayers.Console.warn( 872 OpenLayers.i18n( 873 "methodDeprecated", {'newMethod': 'OpenLayers.Util.getParameters'} 874 ) 875 ); 873 876 return OpenLayers.Util.getParameters(url); 874 877 }; 875 878 … … 1042 1045 // wrapping this in a try/catch because IE chokes on the offsetParent 1043 1046 element = element.offsetParent; 1044 1047 } catch(e) { 1045 OpenLayers.Console.error( 1046 "OpenLayers.Util.pagePosition failed: element with id " + 1047 element.id + " may be misplaced." 1048 ); 1048 OpenLayers.Console.error(OpenLayers.i18n( 1049 "pagePositionFailed",{'elemId':element.id})); 1049 1050 break; 1050 1051 } 1051 1052 } -
lib/OpenLayers/Format.js
old new 68 68 * Depends on the subclass 69 69 */ 70 70 read: function(data) { 71 alert( "Read not implemented.");71 alert(OpenLayers.i18n("readNotImplemented")); 72 72 }, 73 73 74 74 /** … … 82 82 * {String} A string representation of the object. 83 83 */ 84 84 write: function(object) { 85 alert( "Write not implemented.");85 alert(OpenLayers.i18n("writeNotImplemented")); 86 86 }, 87 87 88 88 CLASS_NAME: "OpenLayers.Format" -
lib/OpenLayers/Layer/VirtualEarth.js
old new 137 137 * it working. 138 138 */ 139 139 getWarningHTML:function() { 140 141 var html = ""; 142 html += "The VE Layer was unable to load correctly.<br>"; 143 html += "<br>"; 144 html += "To get rid of this message, select a new BaseLayer "; 145 html += "in the layer switcher in the upper-right corner.<br>"; 146 html += "<br>"; 147 html += "Most likely, this is because the VE library"; 148 html += " script was either not correctly included.<br>"; 149 html += "<br>"; 150 html += "Developers: For help getting this working correctly, "; 151 html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' "; 152 html += "target='_blank'>"; 153 html += "click here"; 154 html += "</a>"; 155 156 return html; 140 return OpenLayers.i18n( 141 "getLayerWarning", {'layerType':'VE', 'layerLib':'VirtualEarth'} 142 ); 157 143 }, 158 144 159 145 -
lib/OpenLayers/Layer/Google.js
old new 309 309 * it working. 310 310 */ 311 311 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.i18n("googleWarning"); 330 313 }, 331 314 332 315 -
lib/OpenLayers/Layer/GML.js
old new 157 157 * request - {String} 158 158 */ 159 159 requestFailure: function(request) { 160 alert( "Error in loading GML file "+this.url);160 alert(OpenLayers.i18n("errorLoadingGML", {'url':this.url})); 161 161 this.events.triggerEvent("loadend"); 162 162 }, 163 163 -
lib/OpenLayers/Layer/Yahoo.js
old new 155 155 * it working. 156 156 */ 157 157 getWarningHTML:function() { 158 159 var html = ""; 160 html += "The Yahoo Layer was unable to load correctly.<br>"; 161 html += "<br>"; 162 html += "To get rid of this message, select a new BaseLayer "; 163 html += "in the layer switcher in the upper-right corner.<br>"; 164 html += "<br>"; 165 html += "Most likely, this is because the Yahoo library"; 166 html += " script was either not correctly included.<br>"; 167 html += "<br>"; 168 html += "Developers: For help getting this working correctly, "; 169 html += "<a href='http://trac.openlayers.org/wiki/Yahoo' "; 170 html += "target='_blank'>"; 171 html += "click here"; 172 html += "</a>"; 173 174 return html; 158 return OpenLayers.i18n( 159 "getLayerWarning", {'layerType':'Yahoo', 'layerLib':'Yahoo'} 160 ); 175 161 }, 176 162 177 163 /********************************************************/ -
lib/OpenLayers/Layer/MultiMap.js
old new 97 97 * it working. 98 98 */ 99 99 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.i18n( 101 "getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"} 102 ); 117 103 }, 118 104 119 105 -
lib/OpenLayers/Layer/WFS.js
old new 234 234 //DEPRECATED - REMOVE IN 3.0 235 235 // don't load data if current zoom level doesn't match 236 236 if (this.options.minZoomLevel) { 237 OpenLayers.Console.warn(OpenLayers.i18n('minZoomLevelError')); 237 238 238 var err = "The minZoomLevel property is only intended for use " +239 "with the FixedZoomLevels-descendent layers. That this " +240 "wfs layer checks for minZoomLevel is a relic of the" +241 "past. We cannot, however, remove it without possibly " +242 "breaking OL based applications that may depend on it." +243 " Therefore we are deprecating it -- the minZoomLevel " +244 "check below will be removed at 3.0. Please instead " +245 "use min/max resolution setting as described here: " +246 "http://trac.openlayers.org/wiki/SettingZoomLevels";247 OpenLayers.Console.warn(err);248 249 239 if (this.map.getZoom() < this.options.minZoomLevel) { 250 240 return null; 251 241 } … … 481 471 commitSuccess: function(request) { 482 472 var response = request.responseText; 483 473 if (response.indexOf('SUCCESS') != -1) { 484 this.commitReport( 'WFS Transaction: SUCCESS', response);474 this.commitReport(OpenLayers.i18n("commitSuccess", {'response':response})); 485 475 486 476 for(var i = 0; i < this.features.length; i++) { 487 477 this.features[i].state = null; … … 490 480 // foreach features: set state to null 491 481 } else if (response.indexOf('FAILED') != -1 || 492 482 response.indexOf('Exception') != -1) { 493 this.commitReport( 'WFS Transaction: FAILED', response);483 this.commitReport(OpenLayers.i18n("commitFailed", {'response':response})); 494 484 } 495 485 }, 496 486 -
lib/OpenLayers/Layer/Vector.js
old new 214 214 */ 215 215 displayError: function() { 216 216 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.i18n("browserNotSupported", 218 {'renderers':this.renderers.join("\n")})); 221 219 } 222 220 }, 223 221 … … 309 307 var feature = features[i]; 310 308 311 309 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 instanceof this.geometryType)) { 311 var throwStr = OpenLayers.i18n('componentShouldBe', 312 {'geomType':this.geometryType.prototype.CLASS_NAME}); 313 throw throwStr; 314 } 317 315 318 316 this.features.push(feature); 319 317 … …
