X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cc5694da1ca047c3e7c57f4de287367788328783..9230721a1f3091ec47d5751c6b5aaead599df49f:/app/views/browse/start.rjs diff --git a/app/views/browse/start.rjs b/app/views/browse/start.rjs index 64e4431a4..b045bc9ea 100644 --- a/app/views/browse/start.rjs +++ b/app/views/browse/start.rjs @@ -2,7 +2,6 @@ page.replace_html :sidebar_title, t('browse.start_rjs.data_frame_title') page.replace_html :sidebar_content, :partial => 'start' 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"); @@ -154,7 +153,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()); } @@ -238,9 +237,9 @@ 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 +441,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 +465,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";