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
19 def wiki_link(type, key, tag)
20 wiki_data = YAML.load_file("#{RAILS_ROOT}/config/wiki-tag-and-key-description.yml")
21 my_locale = I18n.locale.to_s
28 lookup = key + "=" + tag
31 # Try our native language
32 has_primary = wiki_data[my_locale][type][lookup] rescue false
34 ret = wikify(type, key, tag, lookup, wiki_data[my_locale][type][lookup])
36 # Fall back on English
37 has_fallback = wiki_data["en"][type][lookup] rescue false
39 ret = wikify(type, key, tag, lookup, wiki_data["en"][type][lookup])
46 def wikify(type, key, tag, text, wiki)
47 my_locale = I18n.locale
48 url = "http://wiki.openstreetmap.org/index.php?title=#{wiki}&uselang=#{my_locale}"
51 return '<a href="' + url + '" title="' + h(t('browse.tag_details.wiki_link.key', :key => key)) + '">' + h(text) + '</a>'
53 return '<a href="' + url + '" title="' + h(t('browse.tag_details.wiki_link.tag', :key => key, :value => tag)) + '">' + h(tag) + '</a>'