def atom_link_to(*args)
return link_to(image_tag("RSS.gif", :size => "16x16", :border => 0), Hash[*args], { :class => "rsssmall" });
end
+
+ def javascript_strings
+ js = ""
+
+ js << "<script type='text/javascript'>\n"
+ js << "rails_i18n = new Array();\n"
+ js << javascript_strings_for_key("javascripts")
+ js << "</script>\n"
+
+ return js
+ end
+
+private
+
+ def javascript_strings_for_key(key)
+ js = ""
+ value = t(key)
+
+ if value.is_a?(String)
+ js << "rails_i18n['#{key}'] = '" << escape_javascript(value) << "';\n"
+ else
+ value.each_key do |k|
+ js << javascript_strings_for_key("#{key}.#{k}")
+ end
+ end
+
+ return js
+ end
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= I18n.locale %>" lang="<%= I18n.locale %>" dir="<%= t'html.dir' %>">
<head>
- <script type="text/javascript">
- /* This is a hack so we don't have to dynamically generate some of our JavaScript files */
- var rails_i18n = new Array();
- rails_i18n["layouts.edit_zoom_alert"] = '<%= escape_javascript(t('layouts.edit_zoom_alert')) %>';
- rails_i18n["layouts.history_zoom_alert"] = '<%= escape_javascript(t('layouts.history_zoom_alert')) %>';
- // Layer switcher
- rails_i18n["site.layers.base.mapnik"] = '<%= escape_javascript(t('site.layers.base.mapnik')) %>';
- rails_i18n["site.layers.base.osmarender"] = '<%= escape_javascript(t('site.layers.base.osmarender')) %>';
- rails_i18n["site.layers.base.cycle_map"] = '<%= escape_javascript(t('site.layers.base.cycle_map')) %>';
- rails_i18n["site.layers.base.noname"] = '<%= escape_javascript(t('site.layers.base.noname')) %>';
- rails_i18n["site.layers.overlays.maplint"] = '<%= escape_javascript(t('site.layers.overlays.maplint')) %>';
- </script>
+ <%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'site' %>
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
view_tooltip: View maps
edit: Edit
edit_tooltip: Edit maps
- edit_zoom_alert: You must zoom in to edit the map
history: History
history_tooltip: Changeset history
- history_zoom_alert: You must zoom in to see the editing history
export: Export
export_tooltip: Export map data
gps_traces: GPS Traces
delete:
deleted: "Message deleted"
site:
- layers:
- base:
- mapnik: Mapnik
- osmarender: Osmarender
- cycle_map: Cycle Map
- noname: NoName
- overlays:
- maplint: Maplint
index:
js_1: "You are either using a browser that doesn't support JavaScript, or you have disabled JavaScript."
js_2: "OpenStreetMap uses JavaScript for its slippy map."
remove_friend:
success: "{{name}} was removed from your friends."
not_a_friend: "{{name}} is not one of your friends."
+ javascripts:
+ map:
+ base:
+ mapnik: Mapnik
+ osmarender: Osmarender
+ cycle_map: Cycle Map
+ noname: NoName
+ overlays:
+ maplint: Maplint
+ site:
+ edit_zoom_alert: You must zoom in to edit the map
+ history_zoom_alert: You must zoom in to see the editing history
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
- var mapnik = new OpenLayers.Layer.OSM.Mapnik(rails_i18n["site.layers.base.mapnik"], {
+ var mapnik = new OpenLayers.Layer.OSM.Mapnik(rails_i18n["javascripts.map.base.mapnik"], {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
map.addLayer(mapnik);
- var osmarender = new OpenLayers.Layer.OSM.Osmarender(rails_i18n["site.layers.base.osmarender"], {
+ var osmarender = new OpenLayers.Layer.OSM.Osmarender(rails_i18n["javascripts.map.base.osmarender"], {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
map.addLayer(osmarender);
- var cyclemap = new OpenLayers.Layer.OSM.CycleMap(rails_i18n["site.layers.base.cycle_map"], {
+ var cyclemap = new OpenLayers.Layer.OSM.CycleMap(rails_i18n["javascripts.map.base.cycle_map"], {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
map.addLayer(cyclemap);
var nonamekey = nonamekeys[document.domain];
- var noname = new OpenLayers.Layer.OSM(rails_i18n["site.layers.base.noname"], [
+ var noname = new OpenLayers.Layer.OSM(rails_i18n["javascripts.map.base.noname"], [
"http://a.tile.cloudmade.com/" + nonamekey + "/3/256/${z}/${x}/${y}.png",
"http://b.tile.cloudmade.com/" + nonamekey + "/3/256/${z}/${x}/${y}.png",
"http://c.tile.cloudmade.com/" + nonamekey + "/3/256/${z}/${x}/${y}.png"
});
map.addLayer(noname);
- var maplint = new OpenLayers.Layer.OSM.Maplint(rails_i18n["site.layers.overlays.maplint"], {
+ var maplint = new OpenLayers.Layer.OSM.Maplint(rails_i18n["javascripts.map.overlays.maplint"], {
displayOutsideMaxExtent: true,
wrapDateLine: true
});
node.href = setArgs("/edit", args);
node.style.fontStyle = 'normal';
} else {
- node.href = 'javascript:alert(rails_i18n["layouts.edit_zoom_alert"]);';
+ node.href = 'javascript:alert(rails_i18n["javascripts.site.edit_zoom_alert"]);';
node.style.fontStyle = 'italic';
}
}
node.href = setArgs("/history", args);
node.style.fontStyle = 'normal';
} else {
- node.href = 'javascript:alert(rails_i18n["layouts.history_zoom_alert"]);';
+ node.href = 'javascript:alert(rails_i18n["javascripts.site.history_zoom_alert"]);';
node.style.fontStyle = 'italic';
}
}