Skip to content

Commit 18704a7

Browse files
committed
replace return characters with spaces
1 parent 5b3cc4d commit 18704a7

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

js/multilingual_setup.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
function getTranslations(r){
160160
//parse existing data
161161
$('#div_parent_field_annotation textarea').val($('#div_parent_field_annotation textarea').val().replace(/\n([^@])/g, "<br>$1"));
162-
var data = $('#div_parent_field_annotation textarea').val().replace(/___/g, '@');
163-
var tags = data.split('\n');
162+
var data = $('#div_parent_field_annotation textarea').val();
163+
var tags = data.split('@');
164164
var id;
165165
var questions = {};
166166
var answers = {};
@@ -170,20 +170,21 @@
170170
var survey_translations = {"surveytitle":"Survey Title","surveyinstructions":"Survey Instructions","surveyacknowledgment":"Survey Response"}
171171
var others = '';
172172
for(id in tags){
173-
if(tags[id].indexOf('@p1000lang') > -1){
174-
questions = JSON.parse(tags[id].replace('@p1000lang',''));
173+
tags[id] = tags[id].replace(/___/g, '@');
174+
if(tags[id].indexOf('p1000lang') > -1){
175+
questions = JSON.parse(tags[id].replace('p1000lang',''));
175176
}
176-
else if(tags[id].indexOf('@p1000answers') > -1){
177-
answers = JSON.parse(tags[id].replace('@p1000answers',''));
177+
else if(tags[id].indexOf('p1000answers') > -1){
178+
answers = JSON.parse(tags[id].replace('p1000answers',''));
178179
}
179-
else if(tags[id].indexOf('@p1000errors') > -1){
180-
errors = JSON.parse(tags[id].replace('@p1000errors',''));
180+
else if(tags[id].indexOf('p1000errors') > -1){
181+
errors = JSON.parse(tags[id].replace('p1000errors',''));
181182
}
182-
else if(tags[id].indexOf('@p1000notes') > -1){
183-
notes = JSON.parse(tags[id].replace('@p1000notes',''));
183+
else if(tags[id].indexOf('p1000notes') > -1){
184+
notes = JSON.parse(tags[id].replace('p1000notes',''));
184185
}
185-
else if(tags[id].indexOf('@p1000surveytext') > -1){
186-
survey_text = JSON.parse(tags[id].replace('@p1000surveytext',''));
186+
else if(tags[id].indexOf('p1000surveytext') > -1){
187+
survey_text = JSON.parse(tags[id].replace('p1000surveytext',''));
187188
}
188189
else{
189190
others += tags[id] + '\n';
@@ -272,15 +273,16 @@
272273
if(counter > 0){
273274
var questions = {};
274275
$(this).children().val($(this).children().val().replace(/\n([^@])/g, "<br>$1"));
275-
var data = $(this).children().val().replace(/___/g, '@');
276-
var tags = data.split('\n');
276+
var data = $(this).children().val();
277+
var tags = data.split('@');
277278

278279
for(id in tags){
279-
if(tags[id].indexOf('@p1000lang') > -1){
280-
questions = JSON.parse(tags[id].replace('@p1000lang',''));
280+
tags[id] = tags[id].replace(/___/g, '@');
281+
if(tags[id].indexOf('p1000lang') > -1){
282+
questions = JSON.parse(tags[id].replace('p1000lang',''));
281283
}
282-
else if(tags[id].indexOf('@p1000answers') > -1){
283-
answers = JSON.parse(tags[id].replace('@p1000answers',''));
284+
else if(tags[id].indexOf('p1000answers') > -1){
285+
answers = JSON.parse(tags[id].replace('p1000answers',''));
284286
}
285287
}
286288

0 commit comments

Comments
 (0)