]> git.openstreetmap.org Git - rails.git/commitdiff
Make the printable_name() function call i18n.t to translate its
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sun, 28 Jun 2009 21:13:27 +0000 (21:13 +0000)
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Sun, 28 Jun 2009 21:13:27 +0000 (21:13 +0000)
output. Makes e.g. "#{name}, v#{object.version.to_s}" which is used in
the changeset browser translatable.

I'm still not happy with how the anchor is constructed. we're linking
from /browse/changeset/1234 to e.g. node "[[366672999, v1]]" even
though the page we're linking to might take us to that node at version
2. The link should be "[[366672999]], v1" instead.

But that's something to solve later.

app/helpers/browse_helper.rb
config/locales/en.yml
config/locales/is.yml

index 67420151c48efa016f844028b7bfc9d0997af330..879d516eff7b5643f4bd79ca4383ad7088a7c967 100644 (file)
@@ -4,12 +4,12 @@ module BrowseHelper
   end
   
   def printable_name(object, version=false)
-    name = object.id.to_s
+    name = t 'printable_name.with_id', :id => object.id.to_s
     if version
-      name = "#{name}, v#{object.version.to_s}"
+      name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
     end
     if object.tags.include? 'name'
-      name = "#{object.tags['name'].to_s} (#{name})"
+      name = t 'printable_name.with_name',  :name => object.tags['name'].to_s, :id => name
     end
     return name
   end
index 077af5011db055c30c92e05eed2f234eb0aa89cc..0ea50a02abc9073f8f6a2f155609662563ca418f 100644 (file)
@@ -72,6 +72,10 @@ en:
         description: "Description"
         languages: "Languages"
         pass_crypt: "Password"
+  printable_name:
+    with_id: "{{id}}"
+    with_version: "{{id}}, v{{version}}"
+    with_name: "{{name}} ({{id}})"
   map:
     view: View
     edit: Edit
index 7fac2fcd68645a6f68cdd74c05de67f5f05a8950..17429c7ef2a836c04da76360dbb52ecf48c5b8e6 100644 (file)
@@ -72,6 +72,10 @@ is:
         description: "Lýsing"
         languages: "Tungumál"
         pass_crypt: "Lykilorð"
+  printable_name:
+    with_id: "{{id}}"
+    with_version: "{{id}}, útgáfa {{version}}"
+    with_name: "{{name}} ({{id}})"
   map:
     view: "Kort"
     edit: "Breyta"