When displaying objects in /browse/* and in the JavaScript "Data"
feature use the name key corresponding to the user's locale. E.g. "name:is" for Icelandic. This will fall back on "name". The interface will be equivalent unless the user has selected another language than English in the preferences and objects with localized name:* tags corresponding to the user's language are being displayed.
This commit is contained in:
parent
619cacba7c
commit
658a34714f
2 changed files with 20 additions and 4 deletions
|
@ -8,7 +8,9 @@ module BrowseHelper
|
|||
if version
|
||||
name = t 'printable_name.with_version', :id => name, :version => object.version.to_s
|
||||
end
|
||||
if object.tags.include? 'name'
|
||||
if object.tags.include? "name:#{I18n.locale}"
|
||||
name = t 'printable_name.with_name', :name => object.tags["name:#{I18n.locale}"].to_s, :id => name
|
||||
elsif object.tags.include? 'name'
|
||||
name = t 'printable_name.with_name', :name => object.tags['name'].to_s, :id => name
|
||||
end
|
||||
return name
|
||||
|
|
|
@ -262,7 +262,7 @@ page << <<EOJ
|
|||
// Link, for viewing in the tab
|
||||
var link = document.createElement("a");
|
||||
link.href = "/browse/" + type + "/" + feature.osm_id;
|
||||
var name = feature.attributes.name || feature.osm_id;
|
||||
var name = featureName(feature);
|
||||
link.appendChild(document.createTextNode(name));
|
||||
link.feature = feature;
|
||||
link.onclick = OpenLayers.Function.bind(viewFeatureLink, link);
|
||||
|
@ -466,8 +466,20 @@ page << <<EOJ
|
|||
}
|
||||
}
|
||||
|
||||
function featureName(feature) {
|
||||
if (feature.attributes['name:#{I18n.locale}']) {
|
||||
return feature.attributes['name:#{I18n.locale}'];
|
||||
} else if (feature.attributes.name) {
|
||||
return feature.attributes.name;
|
||||
} else {
|
||||
return feature.osm_id;
|
||||
}
|
||||
}
|
||||
|
||||
function featureNameSelect(feature) {
|
||||
if (feature.attributes.name) {
|
||||
if (feature.attributes['name:#{I18n.locale}']) {
|
||||
return feature.attributes['name:#{I18n.locale}'];
|
||||
} else if (feature.attributes.name) {
|
||||
return feature.attributes.name;
|
||||
} else if (featureType(feature) == "node") {
|
||||
return i18n("#{I18n.t('browse.start_rjs.object_list.selected.type.node')}", { id: feature.osm_id });
|
||||
|
@ -477,7 +489,9 @@ page << <<EOJ
|
|||
}
|
||||
|
||||
function featureNameHistory(feature) {
|
||||
if (feature.attributes.name) {
|
||||
if (feature.attributes['name:#{I18n.locale}']) {
|
||||
return feature.attributes['name:#{I18n.locale}'];
|
||||
} else if (feature.attributes.name) {
|
||||
return feature.attributes.name;
|
||||
} else if (featureType(feature) == "node") {
|
||||
return i18n("#{I18n.t('browse.start_rjs.object_list.history.type.node')}", { id: feature.osm_id });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue