2 def link_to_page(page, page_param)
3 return link_to(page, page_param => page)
6 def printable_name(object, version=false)
7 name = t 'printable_name.with_id', :id => object.id.to_s
9 name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
11 if object.tags.include? "name:#{I18n.locale}"
12 name = t 'printable_name.with_name', :name => object.tags["name:#{I18n.locale}"].to_s, :id => name
13 elsif object.tags.include? 'name'
14 name = t 'printable_name.with_name', :name => object.tags['name'].to_s, :id => name
20 if url = wiki_link("key", key)
21 link_to h(key), url, :title => t('browse.tag_details.wiki_link.key', :key => key)
27 def format_value(key, value)
28 if url = wiki_link("tag", "#{key}=#{value}")
29 link_to h(value), url, :title => t('browse.tag_details.wiki_link.tag', :key => key, :value => value)
37 def wiki_link(type, lookup)
38 wiki_data = YAML.load_file("#{RAILS_ROOT}/config/wiki-tag-and-key-description.yml")
39 locale = I18n.locale.to_s
41 if page = wiki_data[locale][type][lookup] rescue nil
42 url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
43 elsif page = wiki_data["en"][type][lookup] rescue nil
44 url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"