X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cc5694da1ca047c3e7c57f4de287367788328783..cd2f19565050ab86d6b437b23261fb891c126e3b:/app/views/browse/start.rjs diff --git a/app/views/browse/start.rjs b/app/views/browse/start.rjs index 64e4431a4..220295663 100644 --- a/app/views/browse/start.rjs +++ b/app/views/browse/start.rjs @@ -76,7 +76,7 @@ page << < '{{num_features}}')}", { num_features: browseFeatureList.length }))); + p.appendChild(document.createTextNode(i18n("#{I18n.t('browse.start_rjs.loaded_an_area_with_num_features')}", { num_features: browseFeatureList.length }))); div.appendChild(p); var input = document.createElement("input"); @@ -187,7 +187,7 @@ page << < #{APP_CONFIG['max_request_area']}) { - setStatus(i18n_js("#{I18n.t('browse.start_rjs.unable_to_load_size', :bbox_size => '{{bbox_size}}', :max_bbox_size => APP_CONFIG['max_request_area'])}", { bbox_size: size })); + setStatus(i18n("#{I18n.t('browse.start_rjs.unable_to_load_size', :max_bbox_size => APP_CONFIG['max_request_area'])}", { bbox_size: size })); } else { loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX()); } @@ -262,7 +262,7 @@ page << < '{{feature}}')}", { feature: featureNameHistory(this.feature) }))); + heading.appendChild(document.createTextNode(i18n("#{I18n.t('browse.start_rjs.history_for_feature')}", { feature: featureNameHistory(this.feature) }))); tr.appendChild(heading); var td = document.createElement("td"); @@ -442,7 +442,7 @@ page << < '{{user}}', :timestamp => '{{timestamp}}')}", { user: user, timestamp: timestamp }))); + item.appendChild(document.createTextNode(i18n("#{I18n.t('browse.start_rjs.edited_by_user_at_timestamp')}", { user: user, timestamp: timestamp }))); history.appendChild(item); } div.appendChild(history); @@ -466,42 +466,40 @@ page << < '{{id}}')}", { id: feature.osm_id }); + return i18n("#{I18n.t('browse.start_rjs.object_list.selected.type.node')}", { id: feature.osm_id }); } else if (featureType(feature) == "way") { - return i18n_js("#{I18n.t('browse.start_rjs.object_list.selected.type.way', :id => '{{id}}')}", { id: feature.osm_id }); + return i18n("#{I18n.t('browse.start_rjs.object_list.selected.type.way')}", { id: feature.osm_id }); } } 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_js("#{I18n.t('browse.start_rjs.object_list.history.type.node', :id => '{{id}}')}", { id: feature.osm_id }); + return i18n("#{I18n.t('browse.start_rjs.object_list.history.type.node')}", { id: feature.osm_id }); } else if (featureType(feature) == "way") { - return i18n_js("#{I18n.t('browse.start_rjs.object_list.history.type.way', :id => '{{id}}')}", { id: feature.osm_id }); + return i18n("#{I18n.t('browse.start_rjs.object_list.history.type.way')}", { id: feature.osm_id }); } } - /* - This is a hack so that we can interpolate JavaScript variables in - translation strings from Ruby, doing the string replacement - client-side instead of on the server. - */ - function i18n_js(string, keys) { - for (var key in keys) { - var re_key = '\{\{' + key + '\}\}'; - var re = new RegExp(re_key, "g"); - - string = string.replace(re, keys[key]); - } - - return string; - } - function setStatus(status) { $("browse_status").innerHTML = status; $("browse_status").style.display = "block";