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:
Tim Schaub
2008-02-15 21:15:48 +00:00
parent bafc8b758b
commit fa55f54e32
30 changed files with 479 additions and 162 deletions

View File

@@ -0,0 +1,25 @@
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Lang/en.js
*/
/**
* Namespace: OpenLayers.Lang["en-CA"]
* Dictionary for English-CA. This dictionary inherits from the standard
* English dictionary. Override only those entries with language specific
* to the CA region.
*
* Keys for entries are used in calls to <OpenLayers.Lang.translate>. Entry
* bodies are normal strings or strings formatted for use with
* <OpenLayers.String.format> calls.
*/
OpenLayers.Lang['en-CA'] = OpenLayers.Util.applyDefaults({
// add any entries specific for this region here
// e.g.
// "someKey": "Some regionally specific value"
}, OpenLayers.Lang["en"]);

120
lib/OpenLayers/Lang/en.js Normal file
View File

@@ -0,0 +1,120 @@
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Lang.js
*/
/**
* Namespace: OpenLayers.Lang["en"]
* Dictionary for English. Keys for entries are used in calls to
* <OpenLayers.Lang.translate>. Entry bodies are normal strings or
* strings formatted for use with <OpenLayers.String.format> calls.
*/
OpenLayers.Lang.en = {
'unhandledRequest': "Unhandled request return ${statusText}",
'permalink': "Permalink",
'overlays': "Overlays",
'baseLayer': "Base Layer",
'sameProjection':
"The overview map only works when it is in the same projection as the main map",
'readNotImplemented': "Read not implemented.",
'writeNotImplemented': "Write not implemented.",
'noFID': "Can't update a feature for which there is no FID.",
'errorLoadingGML': "Error in loading GML file ${url}",
'browserNotSupported':
"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",
'componentShouldBe': "addFeatures : component should be an ${geomType}",
// console message
'getFeatureError':
"getFeatureFromEvent called on layer with no renderer. This usually means you " +
"destroyed a layer, but not some handler which is associated with it.",
// console message
'minZoomLevelError':
"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",
'commitSuccess': "WFS Transaction: SUCCESS ${response}",
'commitFailed': "WFS Transaction: FAILED ${response}",
'googleWarning':
"The Google Layer was unable to load correctly.<br><br>" +
"To get rid of this message, select a new BaseLayer " +
"in the layer switcher in the upper-right corner.<br><br>" +
"Most likely, this is because the Google Maps library " +
"script was either not included, or does not contain the " +
"correct API key for your site.<br><br>" +
"Developers: For help getting this working correctly, " +
"<a href='http://trac.openlayers.org/wiki/Google' " +
"target='_blank'>click here</a>",
'getLayerWarning':
"The ${layerType} Layer was unable to load correctly.<br><br>" +
"To get rid of this message, select a new BaseLayer " +
"in the layer switcher in the upper-right corner.<br><br>" +
"Most likely, this is because the ${layerLib} library " +
"script was either not correctly included.<br><br>" +
"Developers: For help getting this working correctly, " +
"<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
"target='_blank'>click here</a>",
'scale': "Scale = 1 : ${scaleDenom}",
// console message
'layerAlreadyAdded':
"You tried to add the layer: ${layerName} to the map, but it has already been added",
// console message
'reprojectDeprecated':
"You are using the 'reproject' option " +
"on the ${layerName} layer. This option is deprecated: " +
"its use was designed to support displaying data over commercial " +
"basemaps, but that functionality should now be achieved by using " +
"Spherical Mercator support. More information is available from " +
"http://trac.openlayers.org/wiki/SphericalMercator.",
// console message
'methodDeprecated':
"This method has been deprecated and will be removed in 3.0. " +
"Please use ${newMethod} instead.",
// console message
'boundsAddError': "You must pass both x and y values to the add function.",
// console message
'lonlatAddError': "You must pass both lon and lat values to the add function.",
// console message
'pixelAddError': "You must pass both x and y values to the add function.",
// console message
'unsupportedGeometryType': "Unsupported geometry type: ${geomType}",
// console message
'pagePositionFailed':
"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",
'end': ''
};

19
lib/OpenLayers/Lang/fr.js Normal file
View File

@@ -0,0 +1,19 @@
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Lang.js
*/
/**
* Namespace: OpenLayers.Lang["fr"]
* Dictionary for French. Keys for entries are used in calls to
* <OpenLayers.Lang.translate>. Entry bodies are normal strings or
* strings formatted for use with <OpenLayers.String.format> calls.
*/
OpenLayers.Lang.fr = {
'overlays': "Couches de superposition"
};