]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Set the OpenLayers locale when creating a map.
[rails.git] / app / views / site / index.rhtml
index 53a4c9a07800aa27e44576fa278c46532942a4de..3bccb7e044070aa31453abe79643095faa0456cd 100644 (file)
@@ -1,6 +1,6 @@
 <% content_for :greeting do %>
 <% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
-<%= link_to_function 'home', "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)" %> |
+<%= link_to_function t('site.index.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)" %> |
 <% end %>
 <% end %>
 
@@ -97,6 +97,8 @@ end
   var marker;
   var map;
 
+  OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
+
   function mapInit(){
     map = createMap("map");
 
@@ -170,10 +172,12 @@ end
     var zoom = map.getZoom();
     var layers = getMapLayers();
     var extents = getMapExtent();
+    var expiry = new Date();
 
     updatelinks(lonlat.lon, lonlat.lat, zoom, layers, extents.left, extents.bottom, extents.right, extents.top);
-      
-    document.cookie = "_osm_location=" + lonlat.lon + "|" + lonlat.lat + "|" + zoom + "|" + layers;
+
+    expiry.setYear(expiry.getFullYear() + 10); 
+    document.cookie = "_osm_location=" + lonlat.lon + "|" + lonlat.lat + "|" + zoom + "|" + layers + "; expires=" + expiry.toGMTString();
   }
 
   function resizeContent() {