Translation of "other" fields

More
5 years 5 months ago #71327 by reidarborgersen
reidarborgersen created the topic: Translation of "other" fields
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

Please Log in to join the conversation.

More
5 years 5 months ago #71333 by Steve01
Steve01 replied the topic: Aw: Translation of "other" fields
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

Please Log in to join the conversation.

More
5 years 5 months ago #71341 by tpartner
tpartner replied the topic: Aw: Translation of "other" fields
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.

Please Log in to join the conversation.

More
5 years 5 months ago #71364 by reidarborgersen
reidarborgersen replied the topic: Aw: Translation of "other" fields
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.

Please Log in to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #71379 by tpartner
tpartner replied the topic: Aw: Translation of "other" fields
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.
Last Edit: 5 years 5 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 5 months ago #71614 by Mazi
Mazi replied the topic: Aw: Translation of "other" fields
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 5 months ago #71650 by DenisChenu
DenisChenu replied the topic: Aw: Translation of "other" fields
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}


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 5 months ago #71689 by Mazi
Mazi replied the topic: Aw: Translation of "other" fields
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 5 months ago #71734 by DenisChenu
DenisChenu replied the topic: Aw: Translation of "other" fields

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 5 months ago #71801 by Mazi
Mazi replied the topic: Aw: Translation of "other" fields
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago #75584 by Oli_71
Oli_71 replied the topic: Aw: Re: Aw: Translation of "other" fields
Hi,

sorry to put it up again, but neither the css nor the java works with my system (Version 1.91+ Build 120226).

• java enabled
• I do copy the JavaScript into the box where to put normaly the question
• I do use a multiple choice question
• I change QQ by the question ID - syntax: surveyXgroupXQuestion 11111X22X333

"Other" isn´t replaced by 'New label 1' ... in the English version. It is still "other"

May anybody help?

thanks a lot
oli

Please Log in to join the conversation.

More
5 years 3 months ago #75598 by Mazi
Mazi replied the topic: Aw: Re: Aw: Translation of "other" fields
Please post a link to a test survey so we can have a look at the HTML source.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago #75693 by Oli_71
Oli_71 replied the topic: Aw: Re: Aw: Re: Aw: Translation of "other" fields
Thanks for your posting.

It´s an local installation..... I solved the problem by using a second question which is shown when a condition placed on the fisrt question is true.

Oli

Please Log in to join the conversation.

More
5 years 3 months ago #75700 by Mazi
Mazi replied the topic: Aw: Re: Aw: Re: Aw: Translation of "other" fields
Thanks for your feedback.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now