Set OpenLayers lang unobtrusively

We output the locale code as the lang attribute, so
use that rather than interpolating into embedded JS.
This commit is contained in:
John Firebaugh 2012-08-24 19:00:59 -07:00
parent 2ce968b571
commit dcb25f0c07
6 changed files with 3 additions and 11 deletions

View file

@ -35,3 +35,5 @@ OpenLayers.Util.origGetImageLocation = OpenLayers.Util.getImageLocation;
OpenLayers.Util.getImageLocation = function(image) {
return OpenLayers.Util.imageURLs[image] || OpenLayers.Util.origGetImageLocation(image);
};
OpenLayers.Lang.setCode($('html').attr('lang'));

View file

@ -41,8 +41,6 @@
<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
<script type="text/javascript">
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
function remoteEditHandler(event, bbox, select) {
var left = bbox.left - 0.0001;
var top = bbox.top + 0.0001;

View file

@ -5,8 +5,6 @@
</div>
<script type="text/javascript">
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
var highlight;
function highlightChangeset(id) {

View file

@ -56,8 +56,6 @@
<!--
var marker;
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
function setLocation( e ) {
closeMapPopup();

View file

@ -134,8 +134,6 @@ end
var marker;
var map;
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
function mapInit(){
map = createMap("map");

View file

@ -20,8 +20,6 @@ end
<!--
var marker;
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
function init(){
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
<% if params[:scale].to_f > 0 then -%>