Adding framework for internationalization support. The new OpenLayers.Lang.translate method takes a key and looks for a value in a dictionary based on the current language setting. Set a new language code with OpenLayers.Lang.setCode. Get the current code with OpenLayers.Lang.getCode. Thanks to Mike Adair for the lead on this one. r=ahocevar,me (closes #109)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6313 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -157,7 +157,7 @@ OpenLayers.Layer.GML = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
||||
* request - {String}
|
||||
*/
|
||||
requestFailure: function(request) {
|
||||
alert("Error in loading GML file "+this.url);
|
||||
alert(OpenLayers.i18n("errorLoadingGML", {'url':this.url}));
|
||||
this.events.triggerEvent("loadend");
|
||||
},
|
||||
|
||||
|
||||
@@ -309,24 +309,7 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
* it working.
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
var html = "";
|
||||
html += "The Google Layer was unable to load correctly.<br>";
|
||||
html += "<br>";
|
||||
html += "To get rid of this message, select a new BaseLayer ";
|
||||
html += "in the layer switcher in the upper-right corner.<br>";
|
||||
html += "<br>";
|
||||
html += "Most likely, this is because the Google Maps library";
|
||||
html += " script was either not included, or does not contain the";
|
||||
html += " correct API key for your site.<br>";
|
||||
html += "<br>";
|
||||
html += "Developers: For help getting this working correctly, ";
|
||||
html += "<a href='http://trac.openlayers.org/wiki/Google' ";
|
||||
html += "target='_blank'>";
|
||||
html += "click here";
|
||||
html += "</a>";
|
||||
|
||||
return html;
|
||||
return OpenLayers.i18n("googleWarning");
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -97,23 +97,9 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
|
||||
* it working.
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
var html = "";
|
||||
html += "The MM Layer was unable to load correctly.<br>";
|
||||
html += "<br>";
|
||||
html += "To get rid of this message, select a new BaseLayer ";
|
||||
html += "in the layer switcher in the upper-right corner.<br>";
|
||||
html += "<br>";
|
||||
html += "Most likely, this is because the MM library";
|
||||
html += " script was either not correctly included.<br>";
|
||||
html += "<br>";
|
||||
html += "Demmlopers: For help getting this working correctly, ";
|
||||
html += "<a href='http://trac.openlayers.org/wiki/MultiMap' ";
|
||||
html += "target='_blank'>";
|
||||
html += "click here";
|
||||
html += "</a>";
|
||||
|
||||
return html;
|
||||
return OpenLayers.i18n(
|
||||
"getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -214,10 +214,8 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
*/
|
||||
displayError: function() {
|
||||
if (this.reportError) {
|
||||
var message = "Your browser does not support vector rendering. " +
|
||||
"Currently supported renderers are:\n";
|
||||
message += this.renderers.join("\n");
|
||||
alert(message);
|
||||
alert(OpenLayers.i18n("browserNotSupported",
|
||||
{'renderers':this.renderers.join("\n")}));
|
||||
}
|
||||
},
|
||||
|
||||
@@ -309,11 +307,11 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
var feature = features[i];
|
||||
|
||||
if (this.geometryType &&
|
||||
!(feature.geometry instanceof this.geometryType)) {
|
||||
var throwStr = "addFeatures : component should be an " +
|
||||
this.geometryType.prototype.CLASS_NAME;
|
||||
throw throwStr;
|
||||
}
|
||||
!(feature.geometry instanceof this.geometryType)) {
|
||||
var throwStr = OpenLayers.i18n('componentShouldBe',
|
||||
{'geomType':this.geometryType.prototype.CLASS_NAME});
|
||||
throw throwStr;
|
||||
}
|
||||
|
||||
this.features.push(feature);
|
||||
|
||||
@@ -450,7 +448,7 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
*/
|
||||
getFeatureFromEvent: function(evt) {
|
||||
if (!this.renderer) {
|
||||
OpenLayers.Console.error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");
|
||||
OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));
|
||||
return null;
|
||||
}
|
||||
var featureId = this.renderer.getFeatureIdFromEvent(evt);
|
||||
|
||||
@@ -137,23 +137,9 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
|
||||
* it working.
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
var html = "";
|
||||
html += "The VE Layer was unable to load correctly.<br>";
|
||||
html += "<br>";
|
||||
html += "To get rid of this message, select a new BaseLayer ";
|
||||
html += "in the layer switcher in the upper-right corner.<br>";
|
||||
html += "<br>";
|
||||
html += "Most likely, this is because the VE library";
|
||||
html += " script was either not correctly included.<br>";
|
||||
html += "<br>";
|
||||
html += "Developers: For help getting this working correctly, ";
|
||||
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' ";
|
||||
html += "target='_blank'>";
|
||||
html += "click here";
|
||||
html += "</a>";
|
||||
|
||||
return html;
|
||||
return OpenLayers.i18n(
|
||||
"getLayerWarning", {'layerType':'VE', 'layerLib':'VirtualEarth'}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -234,17 +234,7 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
//DEPRECATED - REMOVE IN 3.0
|
||||
// don't load data if current zoom level doesn't match
|
||||
if (this.options.minZoomLevel) {
|
||||
|
||||
var err = "The minZoomLevel property is only intended for use " +
|
||||
"with the FixedZoomLevels-descendent layers. That this " +
|
||||
"wfs layer checks for minZoomLevel is a relic of the" +
|
||||
"past. We cannot, however, remove it without possibly " +
|
||||
"breaking OL based applications that may depend on it." +
|
||||
" Therefore we are deprecating it -- the minZoomLevel " +
|
||||
"check below will be removed at 3.0. Please instead " +
|
||||
"use min/max resolution setting as described here: " +
|
||||
"http://trac.openlayers.org/wiki/SettingZoomLevels";
|
||||
OpenLayers.Console.warn(err);
|
||||
OpenLayers.Console.warn(OpenLayers.i18n('minZoomLevelError'));
|
||||
|
||||
if (this.map.getZoom() < this.options.minZoomLevel) {
|
||||
return null;
|
||||
@@ -481,7 +471,7 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
commitSuccess: function(request) {
|
||||
var response = request.responseText;
|
||||
if (response.indexOf('SUCCESS') != -1) {
|
||||
this.commitReport('WFS Transaction: SUCCESS', response);
|
||||
this.commitReport(OpenLayers.i18n("commitSuccess", {'response':response}));
|
||||
|
||||
for(var i = 0; i < this.features.length; i++) {
|
||||
this.features[i].state = null;
|
||||
@@ -490,7 +480,7 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
|
||||
// foreach features: set state to null
|
||||
} else if (response.indexOf('FAILED') != -1 ||
|
||||
response.indexOf('Exception') != -1) {
|
||||
this.commitReport('WFS Transaction: FAILED', response);
|
||||
this.commitReport(OpenLayers.i18n("commitFailed", {'response':response}));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -155,23 +155,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
|
||||
* it working.
|
||||
*/
|
||||
getWarningHTML:function() {
|
||||
|
||||
var html = "";
|
||||
html += "The Yahoo Layer was unable to load correctly.<br>";
|
||||
html += "<br>";
|
||||
html += "To get rid of this message, select a new BaseLayer ";
|
||||
html += "in the layer switcher in the upper-right corner.<br>";
|
||||
html += "<br>";
|
||||
html += "Most likely, this is because the Yahoo library";
|
||||
html += " script was either not correctly included.<br>";
|
||||
html += "<br>";
|
||||
html += "Developers: For help getting this working correctly, ";
|
||||
html += "<a href='http://trac.openlayers.org/wiki/Yahoo' ";
|
||||
html += "target='_blank'>";
|
||||
html += "click here";
|
||||
html += "</a>";
|
||||
|
||||
return html;
|
||||
return OpenLayers.i18n(
|
||||
"getLayerWarning", {'layerType':'Yahoo', 'layerLib':'Yahoo'}
|
||||
);
|
||||
},
|
||||
|
||||
/********************************************************/
|
||||
|
||||
Reference in New Issue
Block a user