Search code examples
templateslocalizationtranslationlimesurvey

How to add custom text elements in Limesurvey?


By default, Limesurvey provides the follow text elements for the surveys - Survey title, Description, Welcome message, End message etc, which I can use in my template with tags like {SURVEYNAME}, {SURVEYDESCRIPTION}, {WELCOME} etc.

Is it possible to add my own custom field, which I can then use in the template? I need to do it this way because I need to have the text translatable, and present on every page.


Solution

  • You can not add a custom replacement with the current version of LimeSurvey. And your LimeSurvey version seems outdated. But LS includes jquery, therefore it's easy to move some element from a place to elsewhere.

    Quick example:

    <p>Here is your description</p>
    <div style='display:none'>
    <label for='languagechanger' id='labellang'>Here is the new label for language</label>
    </div>
    <script>
    $(function() {
      $("#labellang").insertAfter("#languagechanger")
    });
    </script>
    

    A PHP solution, hacking LimeSurvey code, should be placed at https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/replacements_helper.php#L814