Implement a hack so that we can interpolate JavaScript variables in
translation strings from Ruby, doing the string replacement lient-side instead of on the server. This partially solves ticket:1919. I still have to move the rest of the JS functions over to the new system.
This commit is contained in:
parent
91aaae1933
commit
b653ace377
12 changed files with 28 additions and 23 deletions
|
@ -131,7 +131,7 @@ page << <<EOJ
|
|||
var div = document.createElement("div");
|
||||
|
||||
var p = document.createElement("p");
|
||||
p.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.loaded_an_area')} " + browseFeatureList.length + " #{I18n.t('browse.start_rjs.browsers')}"));
|
||||
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 })));
|
||||
div.appendChild(p);
|
||||
|
||||
var input = document.createElement("input");
|
||||
|
@ -486,6 +486,22 @@ page << <<EOJ
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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";
|
||||
|
|
|
@ -149,8 +149,7 @@ 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: "Du hast einen Bereich geladen, der"
|
||||
browsers: "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: "Konnte nicht geladen werden: Bereich der Größe"
|
||||
must_be_smaller: "ist zu groß (soll kleiner als 0.25 sein)"
|
||||
|
|
|
@ -149,8 +149,7 @@ 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: "You have loaded an area which contains"
|
||||
browsers: "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: "Unable to load: Bounding box size of"
|
||||
must_be_smaller: "is too large (must be smaller than 0.25)"
|
||||
|
|
|
@ -64,8 +64,7 @@ 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: "Vous avez chargé une zone qui contient"
|
||||
browsers: "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: "Impossible de charger les données : la Bounding box d'une taille de"
|
||||
must_be_smaller: "est trop grande (elle doit être plus petite que 0.25)"
|
||||
|
|
|
@ -145,8 +145,7 @@ 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: "You have loaded an area which contains"
|
||||
browsers: "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: "Unable to load: Bounding box size of"
|
||||
must_be_smaller: "is too large (must be smaller than 0.25)"
|
||||
|
|
|
@ -149,8 +149,7 @@ 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: "Þú hefur valið svæði sem á eru"
|
||||
browsers: "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: "Gat ekki hlaðið gögnum: Svæði af stærðinni"
|
||||
must_be_smaller: "er of stórt, svæðið verður að vera minna en 0.25"
|
||||
|
|
|
@ -145,8 +145,7 @@ 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: "E' stata caricata un'area che contiene"
|
||||
browsers: "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: "Impossibile caricare: la dimensione del riquadro di selezione di"
|
||||
must_be_smaller: "è troppo grande (deve essere minore di 0.25)"
|
||||
|
|
|
@ -145,8 +145,7 @@ 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: "Je hebt een gebied geladen dat"
|
||||
browsers: "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: "Niet mogelijk om te laden: grootte van de rechthoek ("
|
||||
must_be_smaller: ") is te groot (moet kleiner zijn dan 0,25)"
|
||||
|
|
|
@ -145,8 +145,7 @@ 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: "Załadowano obszar zawierający"
|
||||
browsers: "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: "Nie można załadować: prostokąt ograniczający"
|
||||
must_be_smaller: "jest zbyt duży (nie może przekraczać 0.25 stopnia)"
|
||||
|
|
|
@ -145,8 +145,7 @@ ru:
|
|||
zoom_or_select: "Увеличьте или выберите область для просмотра"
|
||||
drag_a_box: "Для выбора области растяните рамку по карте"
|
||||
manually_select: "Выделить другую область"
|
||||
loaded_an_area: "Вы загрузили область, которая содержит"
|
||||
browsers: "объектов. Некоторые браузеры могут не справиться с отображением такого количества данных. Обычно браузеры лучшего всего обрабатывают до 100 объектов одновременно. Загрузка большего числа может замедлить ваш браузер или привести к зависанию. Если вы все равно хотите отобразить эти данные, нажмите на кнопку ниже."
|
||||
loaded_an_area_with_num_features: "Вы загрузили область, которая содержит {{num_features}} объектов. Некоторые браузеры могут не справиться с отображением такого количества данных. Обычно браузеры лучшего всего обрабатывают до 100 объектов одновременно. Загрузка большего числа может замедлить ваш браузер или привести к зависанию. Если вы все равно хотите отобразить эти данные, нажмите на кнопку ниже."
|
||||
load_data: "Загрузить данные"
|
||||
unable_to_load: "Загрузка невозможна: размер квадрата"
|
||||
must_be_smaller: "— слишком большой (должен быть меньше 0.25)"
|
||||
|
|
|
@ -145,8 +145,7 @@ 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: "Naložili ste področje, ki vsebuje"
|
||||
browsers: "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: "Ni mogoče naložiti: Pravokotno področje velikosti"
|
||||
must_be_smaller: "je preveliko (mora biti manjše od 0.25)"
|
||||
|
|
|
@ -145,8 +145,7 @@
|
|||
zoom_or_select: "放大或选择查看一个地图区域"
|
||||
drag_a_box: "通过拖曳窗口来选择区域"
|
||||
manually_select: "手动选择一个不同区域"
|
||||
loaded_an_area: "你已经选择了一个区域包括了"
|
||||
browsers: "features. 通常,一些浏览器不能很好显示高精度的数据。一般来讲,当像素点在100一下浏览器的显示效果最好。如果再做别的任务,可能会导致您的浏览器变慢/不响应如果您确定您想要显示这些数据,您可能要点击下面的按钮。"
|
||||
loaded_an_area_with_num_features: "你已经选择了一个区域包括了{{num_features}} features. 通常,一些浏览器不能很好显示高精度的数据。一般来讲,当像素点在100一下浏览器的显示效果最好。如果再做别的任务,可能会导致您的浏览器变慢/不响应如果您确定您想要显示这些数据,您可能要点击下面的按钮。"
|
||||
load_data: "读取数据"
|
||||
unable_to_load: "无法读取:限制窗口的尺寸"
|
||||
must_be_smaller: "过大 (需小于 0.25)"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue