Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Translation of "other" fields

Translation of "other" fields 2 years 10 months ago #71327

When doing a translation on my 4 language survey, the "other" fields are not being translated. I have entered my own alternative text for the other field in the advanced settings, but I have not found a way to translate these fields to other languages. There is no option to do this when doing the quick translation. Anyone had the same problem?

It happens in both "multiple choice" questions and "List (radio)" questions. I need the comment field, otherwise I could just add another reply option.

I am using the Limesurvey Versjon 1.91+ Build 11379.

Thanks.

Reidar
The administrator has disabled public write access.

Aw: Translation of "other" fields 2 years 10 months ago #71333

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

the documentation, docs.limesurvey.org/Question+type+-+Mult...el_for_Other:_option mentions that you can't change the "other" label for multi language surveys using the "Label for 'Other:' option". If you want to change the label you can do that by editing the translation for "other" in the translation files for the languages used in your survey. The article above gives you a link to the "Translating LimeSurvey" article, if you need further help it might be a good idea to have a look at my posts www.limesurvey.org/forum/can-i-do-this-w...g-else?lang=de#71277 or www.limesurvey.org/forum/can-i-do-this-w...essage?lang=de#71305 .
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71341

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4362
  • Thank you received: 827
  • Karma: 381
If you only need this for a single survey, you can use JavaScript to replace "Other" depending on the language.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71364

Thank you for your replies.

I would like to use different alternative texts for the "other" fields in different questions, so changing the translations files in Limesurvey would not help me I think. Thanks anyway.

Javascript would probably do it, but I am not really good at Javascript. I can probably find some instructions in the Limesurvey manual?

For now I have changed my 2 multiple choice questions to multiple choice with comments, and hidden all the commment fields except for the "other" option with CSS. On my radio list question I just added a new open text field question where my respondents can add their comments.
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71379

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4362
  • Thank you received: 827
  • Karma: 381
Here is an example of how to switch the "Other" label for a multiple-options or select-radio question for English, French or German.

1) Set up your survey to use JavaScript.

2) Add the following script to the source of the question. Replace "QQ" with the question ID, add or modify the labels as necessary.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Get the page language
		var lang = $('html').attr('lang');
 
		// Define the new labels
		switch(lang) {
			case 'en' : //English
				var newText1 = 'New label 1';
				break;
			case 'fr' : // French
				var newText1 = 'Nouveau label 1';
				break;
			case 'de' : // German
				var newText1 = 'Neues Label 1';
				break;
			default :
				break;
		}
 
		// Call a function to replace the labels
		replaceOtherText(QQ, newText1);
 
		// A function to replace "Other" labels
		function replaceOtherText(qID, replaceText) {
 
			if($('#question'+qID+'').hasClass('list-radio')) {
				$('#question'+qID+' label[for^="SOTH"]').text(replaceText);
			}
			if($('#question'+qID+'').hasClass('multiple-opt')) {
				$('#question'+qID+' label:last').text(replaceText);
			}
 
		}
	});
 
</script>

If you have several questions on the same page, you can use something like this. replace "QQ" with the first question ID and "RR" with the second question ID.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Get the page language
		var lang = $('html').attr('lang');
 
		// Define the new labels
		switch(lang) {
			case 'en' : //English
				var newText1 = 'New label 1';
				var newText2 = 'New label 2';
				break;
			case 'fr' : // French
				var newText1 = 'Nouveau label 1';
				var newText2 = 'Nouveau label 2';
				break;
			case 'de' : // German
				var newText1 = 'Neues Label 1';
				var newText2 = 'Neues Label 2';
				break;
			default :
				break;
		}
 
		// Call a function to replace the labels
		replaceOtherText(QQ, newText1);
		replaceOtherText(RR, newText2);
 
		// A function to replace "Other" labels
		function replaceOtherText(qID, replaceText) {
 
			if($('#question'+qID+'').hasClass('list-radio')) {
				$('#question'+qID+' label[for^="SOTH"]').text(replaceText);
			}
			if($('#question'+qID+'').hasClass('multiple-opt')) {
				$('#question'+qID+' label:last').text(replaceText);
			}
 
		}
	});
 
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 2 years 10 months ago by tpartner.
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71614

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
To my knowledge multilingual question attributes will be available at Limesurvey 2.0.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71650

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6551
  • Thank you received: 869
  • Karma: 257
And with css only solution:

In other inout box:
<span lang="fr" class="fr">Autres</span><span lang="en" class="en">Other</span>

and in template.css:
.lang-fr .en{display:none}
.lang-en .fr{display:none}
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71689

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
Shnoulle, can you please add that at docs.limesurvey.org/The+template+editor&...rvey#Tips_amp_Tricks

Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71734

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6551
  • Thank you received: 869
  • Karma: 257
The administrator has disabled public write access.

Re: Aw: Translation of "other" fields 2 years 10 months ago #71801

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5423
  • Thank you received: 307
  • Karma: 252
Sure, you can add it at the workarounds, too.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.162 seconds
Donation Image