+ function featureNameHistory(feature) {
+ if (feature.attributes.name) {
+ return feature.attributes.name;
+ } else if (featureType(feature) == "node") {
+ return "#{I18n.t('browse.start_rjs.object_list.history.type.node')} " + feature.osm_id;
+ } else if (featureType(feature) == "way") {
+ return "#{I18n.t('browse.start_rjs.object_list.history.type.way')} " + 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;
+ }
+