Fix warnings arising from geocoder translations, and use count magic
authorTom Hughes <tom@compton.nu>
Tue, 30 Jun 2009 23:45:32 +0000 (23:45 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 30 Jun 2009 23:45:32 +0000 (23:45 +0000)
for the distance translation.

app/controllers/geocoder_controller.rb
config/locales/en.yml
config/locales/sl.yml

index f4c7f852ae9fdcdde2c6a77642841900ebca3f48..622e700afb01c055bf2eada01580e6fe049b3609 100644 (file)
@@ -293,19 +293,18 @@ private
   end
 
   def format_distance(distance)
-    return t "geocoder.results.distance.less_than_1km" if distance == 0
-    return t "geocoder.results.distance.about_distance_km", :distance => distance
+    return t("geocoder.results.distance", :count => distance)
   end
 
   def format_direction(bearing)
-    return t "geocoder.results.direction.south_west" if bearing >= 22.5 and bearing < 67.5
-    return t "geocoder.results.direction.south" if bearing >= 67.5 and bearing < 112.5
-    return t "geocoder.results.direction.south_east" if bearing >= 112.5 and bearing < 157.5
-    return t "geocoder.results.direction.east" if bearing >= 157.5 and bearing < 202.5
-    return t "geocoder.results.direction.north_east" if bearing >= 202.5 and bearing < 247.5
-    return t "geocoder.results.direction.north" if bearing >= 247.5 and bearing < 292.5
-    return t "geocoder.results.direction.north_west" if bearing >= 292.5 and bearing < 337.5
-    return t "geocoder.results.direction.west"
+    return t("geocoder.results.direction.south_west") if bearing >= 22.5 and bearing < 67.5
+    return t("geocoder.results.direction.south") if bearing >= 67.5 and bearing < 112.5
+    return t("geocoder.results.direction.south_east") if bearing >= 112.5 and bearing < 157.5
+    return t("geocoder.results.direction.east") if bearing >= 157.5 and bearing < 202.5
+    return t("geocoder.results.direction.north_east") if bearing >= 202.5 and bearing < 247.5
+    return t("geocoder.results.direction.north") if bearing >= 247.5 and bearing < 292.5
+    return t("geocoder.results.direction.north_west") if bearing >= 292.5 and bearing < 337.5
+    return t("geocoder.results.direction.west")
   end
 
   def format_name(name)
index 647c3c5cc6df7cace8abc5e7763fa057dea9225c..35bb5a67cef939c8bdfb0ab2e55108a080e9269f 100644 (file)
@@ -348,8 +348,9 @@ en:
         suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} of {{parentname}})"
         suffix_suburb: "{{suffix}}, {{parentname}}"
       distance:
-        less_than_1km: "less than 1km"
-        about_distance_km: "about {{distance}}km"
+        zero: "less than 1km"
+        one: "about 1km"
+        other: "about {{count}}km"
       direction:
         south_west: "south-west"
         south: "south"
index ecb7d7136ca74a891cb0e0f3700e71453560c958..e60aec58e0fb1ff40d6b697ca98fb8c1ab1e02a8 100644 (file)
@@ -344,8 +344,9 @@ sl:
         suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} od {{parentname}})"
         suffix_suburb: "{{suffix}}, {{parentname}}"
       distance:
-        less_than_1km: "manj kot 1 km"
-        about_distance_km: "približno {{distance}} km"
+        zero: "manj kot 1 km"
+        one: "približno 1 km"
+        other: "približno {{distance}} km"
       direction:
         south_west: "jugozahodno"
         south: "južno"