- Posts: 17
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
$(document).on('ready pjax:scriptcomplete',function(){ $('.token-page .h3').text("XXXXXXXXXXXXXXXXX"); $('.token-page p.text-info').text("YYYYYYYYYYYYYYYYYYYY"); $('.token-page .control-label').text("ZZZZZZZZZZZZZZZZZZ"); });
How do you handle a multi-languages survey with this workaround?I put this in the "custom.js" of my extended theme
I do not because it was not required.How do you handle a multi-languages survey with this workaround?
var lang = "{LANG}"; if(lang=='en') { var newtext1="AAAA"; var newtext2="BBBBB"; .... } elseif(lang=='it') { var newtext2="BBBBB"; .... } $('.token-page .h3').text(newtext1); ...
When this one is OK : github.com/LimeSurvey/LimeSurvey/pull/2213Thanks for your ideas. Still hoping for a feature to override all text at a central place inside a survey. So that you don't needs to create a language file and don't have to override text via if constructs in a survey with more than one language. But that is a different topic.
It's the way many survey tools implement multilanguage into their applications. One of the biggest feature LimeSurvey has, is the way it handles multi-language surveys. You won't find many surveytools allowing to edit the complete question in different languages. Most have have only a export / import function to translate everything into a different language. No way to e.g. place the images visually for the different languages. That big "pro" for LimeSurvey is not promoted to potential users. To allow overriding/suppressing/control every system message per survey is an common feature.My opinion: create a complete system to have it by surey for ALL language string make a really complex system.
If you don't show all language string, but only replaced one : user don't known what is the string to replace "Submit" or "Next" for example ...
{% extends "./subviews/logincomponents/captcha.twig" %} {% set text1 = { 'en': "My custom header text.", 'fr': "Mon texte de titre personnalisé.", 'de': "Mein benutzerdefinierter Titeltext." } %} {% set text2 = { 'en': "My custom instructions.", 'fr': "Mes instructions personnalisées.", 'de': "Meine individuelle Anleitung." } %} {% set text3 = { 'en': "Custom label", 'fr': "Étiquette personnalisée", 'de': "Benutzerdefiniertes Etikett" } %} {% set lang = aSurveyInfo.languagecode %} {% block formheading %} {{ text1[lang] }} {% endblock %} {% block description %} <p class='{{ aSurveyInfo.class.maincoldivdivbp }} text-info' {{ aSurveyInfo.attr.maincoldivdivbp }}> {% if aSurveyInfo.aForm.token == null %} {{ text2[lang] }} {% else %} {{ gT("Please confirm the token by answering the security question below and click continue.") }} {% endif %} </p> {% endblock %} {% block formcontent %} <div class='{{ aSurveyInfo.class.maincolform }} form-group' {{ aSurveyInfo.attr.maincolform }}> <label class='{{ aSurveyInfo.class.maincolformlabel }} control-label col-sm-3' {{ aSurveyInfo.attr.maincolformlabel }}> <small class="{{ aSurveyInfo.class.maincolformlabelsmall }} text-danger asterisk fa fa-asterisk small " {{ aSurveyInfo.attr.maincolformlabelsmall }} ></small> {{ text3[lang] }} <span class="{{ aSurveyInfo.class.maincolformlabelspan }} sr-only text-danger asterisk " {{ aSurveyInfo.attr.maincolformlabelspan }}> ( {{ gT("Mandatory") }} ) </span> </label> ...
{% extends "./subviews/logincomponents/captcha.twig" %} {% set lang = aSurveyInfo.languagecode %} {% set aText1 = { 'en': "My custom header text.", 'fr': "Mon texte de titre personnalisé.", 'de': "Mein benutzerdefinierter Titeltext.", 'default': gT("To participate in this restricted survey, you need a valid token.") } %} {% if aText1[lang] is defined %} {% set text1 = aText1[lang] %} {% else %} {% set text1 = aText1['default'] %} {% endif %} {% set aText2 = { 'en': "My custom instructions.", 'fr': "Mes instructions personnalisées.", 'de': "Meine individuelle Anleitung.", 'default': gT("If you have been issued a token, please enter it in the box below and click continue.") } %} {% if aText21[lang] is defined %} {% set text2 = aText2[lang] %} {% else %} {% set text2 = aText2['default'] %} {% endif %} {% set aText3 = { 'en': "Custom label", 'fr': "Étiquette personnalisée", 'de': "Benutzerdefiniertes Etikett", 'default': gT("Token:") } %} {% if aText3[lang] is defined %} {% set text3 = aText3[lang] %} {% else %} {% set text3 = aText3['default'] %} {% endif %} {% block formheading %} {{ text1 }} {% endblock %} {% block description %} <p class='{{ aSurveyInfo.class.maincoldivdivbp }} text-info' {{ aSurveyInfo.attr.maincoldivdivbp }}> {% if aSurveyInfo.aForm.token == null %} {{ text2 }} {% else %} {{ gT("Please confirm the token by answering the security question below and click continue.") }} {% endif %} </p> {% endblock %} {% block formcontent %} <div class='{{ aSurveyInfo.class.maincolform }} form-group' {{ aSurveyInfo.attr.maincolform }}> <label class='{{ aSurveyInfo.class.maincolformlabel }} control-label col-sm-3' {{ aSurveyInfo.attr.maincolformlabel }}> <small class="{{ aSurveyInfo.class.maincolformlabelsmall }} text-danger asterisk fa fa-asterisk small " {{ aSurveyInfo.attr.maincolformlabelsmall }} ></small> {{ text3 }} <span class="{{ aSurveyInfo.class.maincolformlabelspan }} sr-only text-danger asterisk " {{ aSurveyInfo.attr.maincolformlabelspan }}> ( {{ gT("Mandatory") }} ) </span> </label> ...
To allow overriding/suppressing/control every system message per survey is an common feature.