]> git.openstreetmap.org Git - rails.git/commitdiff
Rework the javascript I18n interpolation a bit - the interpolation function
authorTom Hughes <tom@compton.nu>
Sun, 7 Jun 2009 08:32:39 +0000 (08:32 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 7 Jun 2009 08:32:39 +0000 (08:32 +0000)
is now in site.js so everything can use it, and the syntax has changed a bit
to avoid the need for double interpolation.

13 files changed:
app/views/browse/start.rjs
config/locales/de.yml
config/locales/en.yml
config/locales/fr.yml
config/locales/he.yml
config/locales/is.yml
config/locales/it.yml
config/locales/nl.yml
config/locales/pl.yml
config/locales/ru.yml
config/locales/sl.yml
config/locales/zh-CN.yml
public/javascripts/site.js

index 64e4431a4c4aee9e175506a22abf5661dd4e7d3b..3043e8330c93f586823798a11cef18908d56b3f0 100644 (file)
@@ -131,7 +131,7 @@ page << <<EOJ
     var div = document.createElement("div");
 
     var p = document.createElement("p");
-    p.appendChild(document.createTextNode(i18n_js("#{I18n.t('browse.start_rjs.loaded_an_area_with_num_features', :num_features => '{{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 << <<EOJ
     var size = projected.getWidth() * projected.getHeight();
 
     if (size > #{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());
     }
@@ -421,7 +421,7 @@ page << <<EOJ
     table.appendChild(tr);
 
     var heading = document.createElement("td");
-    heading.appendChild(document.createTextNode(i18n_js("#{I18n.t('browse.start_rjs.history_for_feature', :feature => '{{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 << <<EOJ
       var user = nodes[i].getAttribute("user") || "#{I18n.t('browse.start_rjs.private_user')}";
       var timestamp = nodes[i].getAttribute("timestamp");
       var item = document.createElement("li");
-      item.appendChild(document.createTextNode(i18n_js("#{I18n.t('browse.start_rjs.edited_by_user_at_timestamp', :user => '{{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);
@@ -470,9 +470,9 @@ page << <<EOJ
     if (feature.attributes.name) {
       return feature.attributes.name;
     } else if (featureType(feature) == "node") {
-      return i18n_js("#{I18n.t('browse.start_rjs.object_list.selected.type.node', :id => '{{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 });
     }
   }
 
@@ -480,28 +480,12 @@ page << <<EOJ
     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";
index 53b437771b6c00e44e31e5f5ea3ae238b65c6bf8..a54078de2db29154a4d6b0063db7d473cce1d40e 100644 (file)
@@ -149,16 +149,16 @@ de:
       zoom_or_select: "Karte vergrössern oder einen Bereich auf der Karte auswählen"
       drag_a_box: "Einen Rahmen über die Karte aufziehen, um einen Bereich auszuwählen"
       manually_select: "Einen anderen Kartenausschnitt manuell auswählen"
-      loaded_an_area_with_num_features: "Du hast einen Bereich geladen, der {{num_features}} Elemente enthält. Manche Browser haben Probleme bei der Darstellung einer so großen Datenmenge. Normalerweise ist es am besten, nur weniger als 100 Elemente zu betrachten; alles andere macht deinen Browser langsam bzw. lässt ihn nicht mehr auf Eingaben reagieren. Wenn du sicher bist, dass du diese Daten darstellen willst, klicke auf \'Daten laden\' unten."
+      loaded_an_area_with_num_features: "Du hast einen Bereich geladen, der [[num_features]] Elemente enthält. Manche Browser haben Probleme bei der Darstellung einer so großen Datenmenge. Normalerweise ist es am besten, nur weniger als 100 Elemente zu betrachten; alles andere macht deinen Browser langsam bzw. lässt ihn nicht mehr auf Eingaben reagieren. Wenn du sicher bist, dass du diese Daten darstellen willst, klicke auf \'Daten laden\' unten."
       load_data: "Daten laden"
-      unable_to_load_size: "Konnte nicht geladen werden: Bereich der Größe {{bbox_size}} ist zu groß (soll kleiner als {{max_bbox_size}} sein)"
+      unable_to_load_size: "Konnte nicht geladen werden: Bereich der Größe [[bbox_size]] ist zu groß (soll kleiner als {{max_bbox_size}} sein)"
       loading: "Laden..."
       show_history: "Chronik"
       wait: "Verarbeiten..."
-      history_for_feature: "Chronik für {{feature}}"
+      history_for_feature: "Chronik für [[feature]]"
       details: "Details"
       private_user: "Anonymer Benutzer"
-      edited_by_user_at_timestamp: "Bearbeitet von {{user}} am {{timestamp}}"
+      edited_by_user_at_timestamp: "Bearbeitet von [[user]] am [[timestamp]]"
       object_list:
         heading: "Object list"
         back: "Display object list"
@@ -170,13 +170,13 @@ de:
         details: "Details"
         selected:
           type:
-            node: "Knoten {{id}}"
-            way: "Weg {{id}}"
+            node: "Knoten [[id]]"
+            way: "Weg [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
         history:
           type:
-            node: "Knoten {{id}}"
-            way: "Weg {{id}}"
+            node: "Knoten [[id]]"
+            way: "Weg [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
     tag_details:
       tags: "Tags:"
index dbcaa65e50a3cd1dc877d883dd29ce4d2810a3ef..ce3d51a5a9e8bc8a5e309f880fea400184729610 100644 (file)
@@ -149,16 +149,16 @@ en:
       zoom_or_select: "Zoom in or select an area of the map to view"
       drag_a_box: "Drag a box on the map to select an area"
       manually_select: "Manually select a different area"
-      loaded_an_area_with_num_features: "You have loaded an area which contains {{num_features}} features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."
+      loaded_an_area_with_num_features: "You have loaded an area which contains [[num_features]] features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."
       load_data: "Load Data"
-      unable_to_load_size: "Unable to load: Bounding box size of {{bbox_size}} is too large (must be smaller than {{max_bbox_size}})"
+      unable_to_load_size: "Unable to load: Bounding box size of [[bbox_size]] is too large (must be smaller than {{max_bbox_size}})"
       loading: "Loading..."
       show_history: "Show History"
       wait: "Wait..."
-      history_for_feature: "History for {{feature}}"
+      history_for_feature: "History for [[feature]]"
       details: "Details"
       private_user: "private user"
-      edited_by_user_at_timestamp: "Edited by {{user}} at {{timestamp}}"
+      edited_by_user_at_timestamp: "Edited by [[user]] at [[timestamp]]"
       object_list:
         heading: "Object list"
         back: "Display object list"
@@ -170,13 +170,13 @@ en:
         details: "Details"
         selected:
           type:
-            node: "Node {{id}}"
-            way: "Way {{id}}"
+            node: "Node [[id]]"
+            way: "Way [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
         history:
           type:
-            node: "Node {{id}}"
-            way: "Way {{id}}"
+            node: "Node [[id]]"
+            way: "Way [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
     tag_details:
       tags: "Tags:"
index e844d028c9db81cd77283166f2dba1ad71de6a08..426eb40b76a98906c5eb38ece7bd520f1ac5a8e8 100644 (file)
@@ -64,16 +64,16 @@ fr:
       zoom_or_select: "Zoomer ou sélectionner une zone de la carte pour la visualiser"
       drag_a_box: "Dessiner une boite sur la carte pour sélectionner une zone"
       manually_select: "Sélectionner manuellement une zone différente"
-      loaded_an_area_with_num_features: "Vous avez chargé une zone qui contient {{num_features}} un grand nombre d'éléments. En général, les navigateurs ne supportent pas bien l'affichage de tant de données, et travaillent mieux lorsqu'ils affichent moins de 100 éléments : accepter peut rendre votre navigateur lent ou non fonctionnel. Si vous etes sûr de vouloir afficher ces données, vous pouvez le faire en appuyant sur le bouton ci-dessous."
+      loaded_an_area_with_num_features: "Vous avez chargé une zone qui contient [[num_features]] un grand nombre d'éléments. En général, les navigateurs ne supportent pas bien l'affichage de tant de données, et travaillent mieux lorsqu'ils affichent moins de 100 éléments : accepter peut rendre votre navigateur lent ou non fonctionnel. Si vous etes sûr de vouloir afficher ces données, vous pouvez le faire en appuyant sur le bouton ci-dessous."
       load_data: "Charger les données"
-      unable_to_load_size: "Impossible de charger les données : la Bounding box d'une taille de {{bbox_size}} est trop grande (elle doit être plus petite que {{max_bbox_size}})"
+      unable_to_load_size: "Impossible de charger les données : la Bounding box d'une taille de [[bbox_size]] est trop grande (elle doit être plus petite que {{max_bbox_size}})"
       loading: "Chargement..."
       show_history: "Montrer l'historique"
       wait: "Patienter..."
-      history_for_feature: "Historique pour {{feature}}"
+      history_for_feature: "Historique pour [[feature]]"
       details: "Détails"
       private_user: "utilisateur privé"
-      edited_by_user_at_timestamp: "Édité par {{user}} le {{timestamp}}"
+      edited_by_user_at_timestamp: "Édité par [[user]] le [[timestamp]]"
   diary_entry:
     new:
       title: "Nouvelle entrée du journal"
index 886ed19eed9c5dc2c63e11a248c51c0dbdc6aba2..15fee96e3cda4bb46a04b061b3f600f1c68ec846 100644 (file)
@@ -145,16 +145,16 @@ he:
       zoom_or_select: "Zoom in or select an area of the map to view"
       drag_a_box: "Drag a box on the map to select an area"
       manually_select: "Manually select a different area"
-      loaded_an_area_with_num_features: "You have loaded an area which contains {{num_features}} features. In general, some browsers may not cope well with displaying this quanity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."
+      loaded_an_area_with_num_features: "You have loaded an area which contains [[num_features]] features. In general, some browsers may not cope well with displaying this quanity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."
       load_data: "Load Data"
-      unable_to_load_size: "Unable to load: Bounding box size of {{bbox_size}} is too large (must be smaller than {{max_bbox_size}})"
+      unable_to_load_size: "Unable to load: Bounding box size of [[bbox_size]] is too large (must be smaller than {{max_bbox_size}})"
       loading: "Loading..."
       show_history: "Show History"
       wait: "Wait..."
-      history_for_feature: "History for {{feature}}"
+      history_for_feature: "History for [[feature]]"
       details: "Details"
       private_user: "private user"
-      edited_by_user_at_timestamp: "Edited by {{user}} at {{timestamp}}"
+      edited_by_user_at_timestamp: "Edited by [[user]] at [[timestamp]]"
     tag_details:
       tags: "Tags:"
     way_details:
index 8ccd80f16ecc4fa0adc020e74a813864abc3888d..0cf8cb4320f28ac4958a7d0534f43a0641fe5546 100644 (file)
@@ -149,16 +149,16 @@ is:
       zoom_or_select: "Þú verður að þysja að eða velja svæði á kortinu"
       drag_a_box: "Teiknaðu kassa á kortið til að velja svæði"
       manually_select: "Velja annað svæði á kortinu"
-      loaded_an_area_with_num_features: "Þú hefur valið svæði sem á eru {{num_features}} hlutir. Sumir vafrar höndla illa fleiri en 100 hluti í einu, en þú getur hlaðið þeim inn þrátt fyrir það ef þú telur þig geta höndlað það."
+      loaded_an_area_with_num_features: "Þú hefur valið svæði sem á eru [[num_features]] hlutir. Sumir vafrar höndla illa fleiri en 100 hluti í einu, en þú getur hlaðið þeim inn þrátt fyrir það ef þú telur þig geta höndlað það."
       load_data: "Hlaða inn gögnum"
-      unable_to_load_size: "Gat ekki hlaðið gögnum: Svæði af stærðinni {{bbox_size}} er of stórt, svæðið verður að vera minna en {{max_bbox_size}}"
+      unable_to_load_size: "Gat ekki hlaðið gögnum: Svæði af stærðinni [[bbox_size]] er of stórt, svæðið verður að vera minna en {{max_bbox_size}}"
       loading: "Hleð inn gögnum..."
       show_history: "Sýna breytingarsögu"
       wait: "Augnablik..."
-      history_for_feature: "Breytingarskrá fyrir {{feature}}"
+      history_for_feature: "Breytingarskrá fyrir [[feature]]"
       details: "Nánar"
       private_user: "ónafngreindum"
-      edited_by_user_at_timestamp: "Breytt af {{user}} klukkan {{timestamp}}"
+      edited_by_user_at_timestamp: "Breytt af [[user]] klukkan [[timestamp]]"
       object_list:
         heading: "Hlutir"
         back: "Aftur á listann yfir hluti á þessu svæði"
@@ -169,13 +169,13 @@ is:
         details: "Nánar"
         selected:
           type:
-            node: "Hnútur {{id}}"
-            way: "Vegur {{id}}"
+            node: "Hnútur [[id]]"
+            way: "Vegur [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
         history:
           type:
-            node: "hnút {{id}}"
-            way: "veg {{id}}"
+            node: "hnút [[id]]"
+            way: "veg [[id]]"
             # There's no 'relation' type because it isn't represented in OpenLayers
     tag_details:
       tags: "Eigindi:"
index 2335a99fba98e26c66c0b56026a9b1091cad0e11..1673b9e008da0131969cfafe0bffe6851a225320 100644 (file)
@@ -145,16 +145,16 @@ it:
       zoom_or_select: "Ingrandire oppure selezionare l'area della mappa che si desidera visualizzare"
       drag_a_box: "Tracciare un riquadro sulla mappa per selezionare un'area"
       manually_select: "Seleziona manualmente un'area differente"
-      loaded_an_area_with_num_features: "E' stata caricata un'area che contiene {{num_features}} caratteristiche. In generale, alcuni browser potrebbero non visualizzare correttamente questa quantità di dati. Generalmente i browser lavorano al meglio  se si visualizzano meno di 100 caratteristiche alla volta: se si fa qualcos'altro il proprio browser potrebbe diventare lento o non rispondere più. Se si è sicuri di voler visualizzare questi dati, allora si può premere il pulsante sottostante."
+      loaded_an_area_with_num_features: "E' stata caricata un'area che contiene [[num_features]] caratteristiche. In generale, alcuni browser potrebbero non visualizzare correttamente questa quantità di dati. Generalmente i browser lavorano al meglio  se si visualizzano meno di 100 caratteristiche alla volta: se si fa qualcos'altro il proprio browser potrebbe diventare lento o non rispondere più. Se si è sicuri di voler visualizzare questi dati, allora si può premere il pulsante sottostante."
       load_data: "Carica dati"
-      unable_to_load_size: "Impossibile caricare: la dimensione del riquadro di selezione di {{bbox_size}} è troppo grande (deve essere minore di {{max_bbox_size}})"
+      unable_to_load_size: "Impossibile caricare: la dimensione del riquadro di selezione di [[bbox_size]] è troppo grande (deve essere minore di {{max_bbox_size}})"
       loading: "Caricamento in corso..."
       show_history: "Visualizza storico"
       wait: "Attendere..."
-      history_for_feature: "Storico per {{feature}}"
+      history_for_feature: "Storico per [[feature]]"
       details: "Dettagli"
       private_user: "utente privato"
-      edited_by_user_at_timestamp: "Modificato da {{user}} il {{timestamp}}"
+      edited_by_user_at_timestamp: "Modificato da [[user]] il [[timestamp]]"
     tag_details:
       tags: "Etichette:"
     way_details:
index b9e9299c2bb4f77bcd3fae4a2e530b021a80a1ea..d0eae627907cb0c18695ee8ee557459d59e8dccb 100644 (file)
@@ -145,16 +145,16 @@ nl:
       zoom_or_select: "Zoom in of selecteer een gebied van de kaart om te zien"
       drag_a_box: "Sleep een rechthoek op de kaart om een gebied te selecteren"
       manually_select: "Selecteer handmatig een ander gebied"
-      loaded_an_area_with_num_features: "Je hebt een gebied geladen dat {{num_features}} objecten bevat. In het algemeen kunnen sommige browsers niet goed overweg met zoveel gegevens. Normaal gesproken werken browsers het best met minder dan 100 objecten: als je meer weergeeft kan de browser traag worden of niet meer reageren. Als je zeker weet dat je de gegevens wilt laten zien, kan dat met de knop hieronder."
+      loaded_an_area_with_num_features: "Je hebt een gebied geladen dat [[num_features]] objecten bevat. In het algemeen kunnen sommige browsers niet goed overweg met zoveel gegevens. Normaal gesproken werken browsers het best met minder dan 100 objecten: als je meer weergeeft kan de browser traag worden of niet meer reageren. Als je zeker weet dat je de gegevens wilt laten zien, kan dat met de knop hieronder."
       load_data: "Gegevens laden"
-      unable_to_load_size: "Niet mogelijk om te laden: grootte van de rechthoek ({{bbox_size}}) is te groot (moet kleiner zijn dan {{max_bbox_size}})"
+      unable_to_load_size: "Niet mogelijk om te laden: grootte van de rechthoek ([[bbox_size]]) is te groot (moet kleiner zijn dan {{max_bbox_size}})"
       loading: "Laden..."
       show_history: "Geschiedenis weergeven"
       wait: "Een ogenblik geduld a.u.b..."
-      history_for_feature: "Geschiedenis voor {{feature}}"
+      history_for_feature: "Geschiedenis voor [[feature]]"
       details: "Details"
       private_user: "private user" #to be translated
-      edited_by_user_at_timestamp: "Bewerkt door {{user}} op {{timestamp}}"
+      edited_by_user_at_timestamp: "Bewerkt door [[user]] op [[timestamp]]"
     tag_details:
       tags: "Tags:"
     way_details:
index 3903c6f0cb572aaad49ffc17f029a8e5441ac38f..6d4de8e26afca592137481bec25a4510523c268e 100644 (file)
@@ -145,16 +145,16 @@ pl:
       zoom_or_select: "Przybliż albo wybierz inny obszar mapy"
       drag_a_box: "Zaznacz prostokąt na mapie przeciągnięciem myszki aby wybrać obszar"
       manually_select: "Manualnie wybierz inny obszar"
-      loaded_an_area_with_num_features: "Załadowano obszar zawierający {{num_features}} obiektów.  Przeglądarki mogą nie radzić sobie z wyświetleniem tej ilości danych -- generalnie działają optymalnie przy wyświetlaniu mniej niż 100 obiektów jednocześnie, w przeciwnym wypadku przeglądarka może działac powoli lub przestać odpowiadać.  Jeśli jesteś pewien że chcesz wyświetlić dane, kliknij przycisk poniżej."
+      loaded_an_area_with_num_features: "Załadowano obszar zawierający [[num_features]] obiektów.  Przeglądarki mogą nie radzić sobie z wyświetleniem tej ilości danych -- generalnie działają optymalnie przy wyświetlaniu mniej niż 100 obiektów jednocześnie, w przeciwnym wypadku przeglądarka może działac powoli lub przestać odpowiadać.  Jeśli jesteś pewien że chcesz wyświetlić dane, kliknij przycisk poniżej."
       load_data: "Załaduj dane"
-      unable_to_load_size: "Nie można załadować: prostokąt ograniczający {{bbox_size}} jest zbyt duży (nie może przekraczać {{max_bbox_size}} stopnia)"
+      unable_to_load_size: "Nie można załadować: prostokąt ograniczający [[bbox_size]] jest zbyt duży (nie może przekraczać {{max_bbox_size}} stopnia)"
       loading: "Wczytywanie..."
       show_history: "Pokaż zmiany"
       wait: "Moment..."
-      history_for_feature: "Historia zmian dla {{feature}}"
+      history_for_feature: "Historia zmian dla [[feature]]"
       details: "Szczegóły"
       private_user: "prywatny użytkownika"
-      edited_by_user_at_timestamp: "Edytowany przez {{user}} ostatni raz {{timestamp}}"
+      edited_by_user_at_timestamp: "Edytowany przez [[user]] ostatni raz [[timestamp]]"
     tag_details:
       tags: "Tagi:"
     way_details:
index 8e643997a8091b0834cefad1037db818415d6e3e..65f35140c114f3c4f94effea7df260c9b2a159ce 100644 (file)
@@ -145,16 +145,16 @@ ru:
       zoom_or_select: "Увеличьте или выберите область для просмотра"
       drag_a_box: "Для выбора области растяните рамку по карте"
       manually_select: "Выделить другую область"
-      loaded_an_area_with_num_features: "Вы загрузили область, которая содержит {{num_features}} объектов. Некоторые браузеры могут не справиться с отображением такого количества данных. Обычно браузеры лучшего всего обрабатывают до 100 объектов одновременно. Загрузка большего числа может замедлить ваш браузер или привести к зависанию. Если вы все равно хотите отобразить эти данные, нажмите на кнопку ниже."
+      loaded_an_area_with_num_features: "Вы загрузили область, которая содержит [[num_features]] объектов. Некоторые браузеры могут не справиться с отображением такого количества данных. Обычно браузеры лучшего всего обрабатывают до 100 объектов одновременно. Загрузка большего числа может замедлить ваш браузер или привести к зависанию. Если вы все равно хотите отобразить эти данные, нажмите на кнопку ниже."
       load_data: "Загрузить данные"
-      unable_to_load_size: "Загрузка невозможна: размер квадрата {{bbox_size}} — слишком большой (должен быть меньше {{max_bbox_size}})"
+      unable_to_load_size: "Загрузка невозможна: размер квадрата [[bbox_size]] — слишком большой (должен быть меньше {{max_bbox_size}})"
       loading: "Загрузка..."
       show_history: "Показать историю"
       wait: "Подождите..."
-      history_for_feature: "История {{feature}}"
+      history_for_feature: "История [[feature]]"
       details: "Детали"
       private_user: "частный пользователь"
-      edited_by_user_at_timestamp: "Изменен {{user}} в {{timestamp}}"
+      edited_by_user_at_timestamp: "Изменен [[user]] в [[timestamp]]"
     tag_details:
       tags: "Теги:"
     way_details:
index 3962cae217e095e613393ef8033e4cf102835a6a..f1f08b9c3f69cec9967ee28f676c9ac32b192d70 100644 (file)
@@ -145,16 +145,16 @@ sl:
       zoom_or_select: "Povečajte zemljevid ali izberite področje za prikaz"
       drag_a_box: "Za izbor področja povlecite pravokotnik na zemljevidu"
       manually_select: "Ročno izberite drugo področje"
-      loaded_an_area_with_num_features: "Naložili ste področje, ki vsebuje {{num_features}} elementov. Nekateri spletni brskalniki ne zmorejo prikaza takšne količine podatkov. Na splošno brskalniki najbolje prikazujejo 100 ali manj elementov hkrati: karkoli drugega lahko upočasni vaš brskalnik ali ga naredi neodzivnega. Če ste prepričani, da želite prikazati vse te podatke, pritisnite na spodnji gumb."
+      loaded_an_area_with_num_features: "Naložili ste področje, ki vsebuje [[num_features]] elementov. Nekateri spletni brskalniki ne zmorejo prikaza takšne količine podatkov. Na splošno brskalniki najbolje prikazujejo 100 ali manj elementov hkrati: karkoli drugega lahko upočasni vaš brskalnik ali ga naredi neodzivnega. Če ste prepričani, da želite prikazati vse te podatke, pritisnite na spodnji gumb."
       load_data: "Naloži podatke"
-      unable_to_load_size: "Ni mogoče naložiti: Pravokotno področje velikosti {{bbox_size}} je preveliko (mora biti manjše od {{max_bbox_size}})"
+      unable_to_load_size: "Ni mogoče naložiti: Pravokotno področje velikosti [[bbox_size]] je preveliko (mora biti manjše od {{max_bbox_size}})"
       loading: "Nalaganje..."
       show_history: "Prikaži zgodovino"
       wait: "Počakajte..."
-      history_for_feature: "Zgodovina {{feature}}"
+      history_for_feature: "Zgodovina [[feature]]"
       details: "Podrobnosti"
       private_user: "anonimni uporabnik"
-      edited_by_user_at_timestamp: "Uredil {{user}} ob {{timestamp}}"
+      edited_by_user_at_timestamp: "Uredil [[user]] ob [[timestamp]]"
     tag_details:
       tags: "Oznake:"
     way_details:
index 1541e8d5ebc4c9dc219e85e0f547d084bef1e116..9962ef270902551180f3c350326af4adae51d892 100644 (file)
@@ -1,4 +1,4 @@
-"zh-CN":
+zh-CN:
   activerecord:
     # Translates all the model names, which is used in error handling on the web site
     models:
       zoom_or_select: "放大或选择查看一个地图区域"
       drag_a_box: "通过拖曳窗口来选择区域"
       manually_select: "手动选择一个不同区域"
-      loaded_an_area_with_num_features: "你已经选择了一个区域包括了{{num_features}} features. 通常,一些浏览器不能很好显示高精度的数据。一般来讲,当像素点在100一下浏览器的显示效果最好。如果再做别的任务,可能会导致您的浏览器变慢/不响应如果您确定您想要显示这些数据,您可能要点击下面的按钮。"
+      loaded_an_area_with_num_features: "你已经选择了一个区域包括了[[num_features]] features. 通常,一些浏览器不能很好显示高精度的数据。一般来讲,当像素点在100一下浏览器的显示效果最好。如果再做别的任务,可能会导致您的浏览器变慢/不响应如果您确定您想要显示这些数据,您可能要点击下面的按钮。"
       load_data: "读取数据"
-      unable_to_load_size: "无法读取:限制窗口的尺寸{{bbox_size}} 过大 (需小于 {{max_bbox_size}})"
+      unable_to_load_size: "无法读取:限制窗口的尺寸[[bbox_size]] 过大 (需小于 {{max_bbox_size}})"
       loading: "读取中"
       show_history: "显示历史"
       wait: "等待中..."
-      history_for_feature: "历史 {{feature}}"
+      history_for_feature: "历史 [[feature]]"
       details: "细节"
       private_user: "个人用户"
-      edited_by_user_at_timestamp: "Edited by {{user}} at {{timestamp}}"
+      edited_by_user_at_timestamp: "Edited by [[user]] at [[timestamp]]"
     tag_details:
       tags: "标签:"
     way_details:
index 8f9d3a035feb8f54e99ddf75bb102e94ae53b785..e0c18a27b5005fee572114de23388d360ef31b0e 100644 (file)
@@ -1,5 +1,7 @@
-//Called as the user scrolls/zooms around.
-//Maniplate hrefs of the view tab and various other links
+/*
+ * Called as the user scrolls/zooms around to aniplate hrefs of the
+ * view tab and various other links
+ */
 function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat) {
   var decimals = Math.pow(10, Math.floor(zoom/3));
   var node;
@@ -104,6 +106,9 @@ function getArgs(url) {
   return args;
 }
 
+/*
+ * Called to set the arguments on a URL from the given hash.
+ */
 function setArgs(url, args) {
    var queryitems = new Array();
 
@@ -119,6 +124,9 @@ function setArgs(url, args) {
    return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");
 }
 
+/*
+ * Called to get the arguments from a URL as a hash.
+ */
 function getStyle(el, property) {
   var style;
 
@@ -132,3 +140,21 @@ function getStyle(el, property) {
 
   return style;
 }
+
+/*
+ * Called to interpolate JavaScript variables in strings using a
+ * similar syntax to rails I18n string interpolation - the only
+ * difference is that [[foo]] is the placeholder syntax instead
+ * of {{foo}} which allows the same string to be processed by both
+ * rails and then later by javascript.
+ */
+function i18n(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;
+}