Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Language detection in template files

  • tacman1123
  • tacman1123's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 9 months ago #73436 by tacman1123
Language detection in template files was created by tacman1123
I want to use a different logo, depending on the language. Is there a way to display a logo conditionally? Something like

<img src="/images/{if(LANGUAGE=='en','en_logo','other_logo')}.png" />

Except I don't think there's a keyword LANGUAGE.

Gracias,

Tac
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 8 months ago #73454 by Mazi
Replied by Mazi on topic Language detection in template files
It might be possible by adjusting this workaround: docs.limesurvey.org/The+template+editor&...age_specific_element

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • tacman1123
  • tacman1123's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 8 months ago #73472 by tacman1123
Replied by tacman1123 on topic Language detection in template files
Thanks -- what are the better solutions in 1.92? I'm guessing Expression Manager gives us a bit more power. The old way of writing javascript to customize a question never felt right, but the new way is quite elegant.
The topic has been locked.
  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 8 months ago #73474 by TMSWhite
Replied by TMSWhite on topic Language detection in template files
There is a {LANG} keyword, so you could do this:
Code:
<img src="/images/{if(LANG=='en','en_logo','other_logo')}.png" />

or, since you should know all possible languages your survey uses:
Code:
<img src="/images/{LANG}_logo.png" />
The following user(s) said Thank You: tacman1123
The topic has been locked.
  • tacman1123
  • tacman1123's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 8 months ago #73478 by tacman1123
Replied by tacman1123 on topic Language detection in template files
Perfect, thanks! Where are the keywords documented? I found the if() syntax while looking at something else, is there more documentation on what the template language can do, like loops or more sophisticated if structures, like Smarty or Twig?

I'm a big fan of both Smarty and Twig, and would be thrilled if LS2.0 consider using them. They're quite fast and have great support.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 8 months ago #73481 by Mazi
Replied by Mazi on topic Language detection in template files
Tom, I couldn't find the {LANG} keyword at one of those lionks:
docs.limesurvey.org/The+template+editor&...+LimeSurvey#Keywords
docs.limesurvey.org/Expression+Manager+H...tions+for+LimeSurvey
docs.limesurvey.org/Expression+Manager+f...tions+for+LimeSurvey

...but I remember you once created a keyword overview. Is this still available and do you think we can place that somewhere else at the manual so that users know which placeholders they can deal with?

@tacman: We are now moving all code to the MVC framework "Yii" for the Limesurvey 2.0 release so such thing is not on the list yet but we hope to lay the basics for it this way.
You can add this as a feature request at our feature tracker . Please describe your idea as detailed as possible and try to outline a suitable solution/implementation as well.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
12 years 8 months ago #73498 by TMSWhite
Replied by TMSWhite on topic Language detection in template files
Here is the list of keywords from the last analysis I did. Someone should update the documentation to list any missing ones.

As to documentation about the if() syntax, etc., there is an EM button within 1.92 under survey-specific tools that generates a table of all of the supported functions and their documentation. This table in the main EM documentation should also be up-to-date.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
12 years 8 months ago #73513 by Mazi
Replied by Mazi on topic Language detection in template files
Can we somehow make the list of keywords a little smaller so that it is easier to read and easier to embedd at the documentation?
Maybe separate it into sections (template placeholders, token placeholders, ...)?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
9 years 7 months ago #117984 by jelo
Replied by jelo on topic Language detection in template files

Mazi wrote: Can we somehow make the list of keywords a little smaller so that it is easier to read and easier to embedd at the documentation?
Maybe separate it into sections (template placeholders, token placeholders, ...)?

Where is the keyword list now? 90% of the links are lost and the Wiki is just redirecting to main page instead of offering best matches or trying to recreate a temp link. The search isn't helping either.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #117985 by tpartner
Replied by tpartner on topic Language detection in template files

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
9 years 7 months ago #117989 by jelo
Replied by jelo on topic Language detection in template files
Thanks, wonder why the search wasn't showing that page.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose