Made a bunch of start.rjs stuff translatable, including
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 6 Jun 2009 15:05:39 +0000 (15:05 +0000)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sat, 6 Jun 2009 15:05:39 +0000 (15:05 +0000)
 * Object list, API, Display object list, Details

Also make node/way/relation translatable, and in different contexts
too (e.g. Icelandic needs this).

This introduces more stuff that needs to be fixed in ticket 1919.

app/views/browse/start.rjs
config/locales/en.yml
config/locales/is.yml

index c7a795b9806562082d750a26ac07a512a7c4354b..9c885870b81516cc02306f45bc3ce1d87730e1d5 100644 (file)
@@ -245,19 +245,23 @@ page << <<EOJ
 
       var heading = document.createElement("p");
       heading.className = "browse_heading";
 
       var heading = document.createElement("p");
       heading.className = "browse_heading";
-      heading.appendChild(document.createTextNode("Object list"));
+      heading.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.object_list.heading')}"));
       browseObjectList.appendChild(heading);
 
       var list = document.createElement("ul");
       browseObjectList.appendChild(heading);
 
       var list = document.createElement("ul");
+      // Pull in 118n names for node/way/relation
+      var typeTranslations = new Array();
+      typeTranslations['node']     = "#{I18n.t('browse.start_rjs.object_list.type.node')}"
+      typeTranslations['way']      = "#{I18n.t('browse.start_rjs.object_list.type.way')}"
+      typeTranslations['relation'] = "#{I18n.t('browse.start_rjs.object_list.type.relation')}"
 
       for (var i = 0; i < this.features.length; i++) {
         var feature = this.features[i]; 
             
         // Type, for linking
         var type = featureType(feature);
 
       for (var i = 0; i < this.features.length; i++) {
         var feature = this.features[i]; 
             
         // Type, for linking
         var type = featureType(feature);
-        var typeName = ucFirst(type);
         var li = document.createElement("li");
         var li = document.createElement("li");
-        li.appendChild(document.createTextNode(typeName + " "));
+        li.appendChild(document.createTextNode(typeTranslations[type] + " "));
             
         // Link, for viewing in the tab
         var link = document.createElement("a");
             
         // Link, for viewing in the tab
         var link = document.createElement("a");
@@ -275,7 +279,7 @@ page << <<EOJ
 
       var link = document.createElement("a");
       link.href = this.url;
 
       var link = document.createElement("a");
       link.href = this.url;
-      link.appendChild(document.createTextNode("API"));
+      link.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.object_list.api')}"));
       browseObjectList.appendChild(link);
 
       $("browse_content").innerHTML = "";
       browseObjectList.appendChild(link);
 
       $("browse_content").innerHTML = "";
@@ -336,7 +340,7 @@ page << <<EOJ
     var link = document.createElement("a");
     link.href = "#";
     link.onclick = loadObjectList;
     var link = document.createElement("a");
     link.href = "#";
     link.onclick = loadObjectList;
-    link.appendChild(document.createTextNode("Display object list"));
+    link.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.object_list.back')}"));
     div.appendChild(link);
 
     var table = document.createElement("table");
     div.appendChild(link);
 
     var table = document.createElement("table");
@@ -348,7 +352,7 @@ page << <<EOJ
     table.appendChild(tr);
 
     var heading = document.createElement("td");
     table.appendChild(tr);
 
     var heading = document.createElement("td");
-    heading.appendChild(document.createTextNode(featureName(feature)));
+    heading.appendChild(document.createTextNode(featureNameSelect(feature)));
     tr.appendChild(heading);
 
     var td = document.createElement("td");
     tr.appendChild(heading);
 
     var td = document.createElement("td");
@@ -358,7 +362,7 @@ page << <<EOJ
     var type = featureType(feature);
     var link = document.createElement("a");   
     link.href = "/browse/" + type + "/" + feature.osm_id;
     var type = featureType(feature);
     var link = document.createElement("a");   
     link.href = "/browse/" + type + "/" + feature.osm_id;
-    link.appendChild(document.createTextNode("Details"));
+    link.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.object_list.details')}"));
     td.appendChild(link);
 
     var div = document.createElement("div");
     td.appendChild(link);
 
     var div = document.createElement("div");
@@ -421,7 +425,7 @@ page << <<EOJ
     table.appendChild(tr);
 
     var heading = document.createElement("td");
     table.appendChild(tr);
 
     var heading = document.createElement("td");
-    heading.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.history_for')} " + featureName(this.feature)));
+    heading.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.history_for')} " + featureNameHistory(this.feature)));
     tr.appendChild(heading);
 
     var td = document.createElement("td");
     tr.appendChild(heading);
 
     var td = document.createElement("td");
@@ -458,11 +462,27 @@ page << <<EOJ
     }
   }
   
     }
   }
   
-  function featureName(feature) {
+  function featureNameSelect(feature) {
     if (feature.attributes.name) {
       return feature.attributes.name;
     } else {
     if (feature.attributes.name) {
       return feature.attributes.name;
     } else {
-      return ucFirst(featureType(feature)) + " " + feature.osm_id;
+      // Pull in 118n names for node/way
+      var featureNameSelectTypeTranslations = new Array();
+      featureNameSelectTypeTranslations['node'] = "#{I18n.t('browse.start_rjs.object_list.selected.type.node')}"
+      featureNameSelectTypeTranslations['way']  = "#{I18n.t('browse.start_rjs.object_list.selected.type.way')}"
+      return featureNameSelectTypeTranslations[featureType(feature)] + " " + feature.osm_id;
+    }
+  }
+
+  function featureNameHistory(feature) {
+    if (feature.attributes.name) {
+      return feature.attributes.name;
+    } else {
+      // Pull in 118n names for node/way
+      var featureNameHistoryTypeTranslations = new Array();
+      featureNameHistoryTypeTranslations['node'] = "#{I18n.t('browse.start_rjs.object_list.history.type.node')}"
+      featureNameHistoryTypeTranslations['way']  = "#{I18n.t('browse.start_rjs.object_list.history.type.way')}"
+      return featureNameHistoryTypeTranslations[featureType(feature)] + " " + feature.osm_id;
     }
   }
 
     }
   }
 
index 562aa47efb5434dec0e81882321c8f3060c8e5e6..1a84d046c186efe7f780efaded8bf6a8dde5613c 100644 (file)
@@ -162,6 +162,25 @@ en:
       private_user: "private user"
       edited_by: "Edited by"
       at_timestamp: "at"
       private_user: "private user"
       edited_by: "Edited by"
       at_timestamp: "at"
+      object_list:
+        heading: "Object list"
+        back: "Display object list"
+        type:
+          node: "Node"
+          way: "Way"
+          relation: "Relation"
+        api: "Retrieve this are from the API"
+        details: "Details"
+        selected:
+          type:
+            node: "Node"
+            way: "Way"
+            # There's no 'relation' type because it isn't represented in OpenLayers
+        history:
+          type:
+            node: "Node"
+            way: "Way"
+            # There's no 'relation' type because it isn't represented in OpenLayers
     tag_details:
       tags: "Tags:"
     way_details:
     tag_details:
       tags: "Tags:"
     way_details:
index d6fb58f1b0d51b7eaaa4971a09566a522bfc9137..f9cf07367e0ce357b38f1d01d1cc9cb1c48ef76d 100644 (file)
@@ -158,10 +158,29 @@ is:
       show_history: "Sýna breytingarsögu"
       wait: "Augnablik..."
       history_for: "Breytingarskrá fyrir"
       show_history: "Sýna breytingarsögu"
       wait: "Augnablik..."
       history_for: "Breytingarskrá fyrir"
-      details: "Frekari upplýsingar"
+      details: "Nánar"
       private_user: "private user"
       edited_by: "Breytt af"
       at_timestamp: "klukkan"
       private_user: "private user"
       edited_by: "Breytt af"
       at_timestamp: "klukkan"
+      object_list:
+        heading: "Hlutir"
+        back: "Aftur á listann yfir hluti á þessu svæði"
+        type:
+          node: "Hnúturinn"
+          way: "Vegurinn"
+          relation: "Venslin"
+        api: "Niðurhala þessu svæði úr forritunarviðmótinu"
+        details: "Nánar"
+        selected:
+          type:
+            node: "Hnútur"
+            way: "Vegur"
+            # There's no 'relation' type because it isn't represented in OpenLayers
+        history:
+          type:
+            node: "hnút"
+            way: "veg"
+            # There's no 'relation' type because it isn't represented in OpenLayers
     tag_details:
       tags: "Eigindi:"
     way_details:
     tag_details:
       tags: "Eigindi:"
     way_details: