Language detection in template files

More
5 years 8 months ago #73436 by tacman1123
tacman1123 created the topic: Language detection in template files
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

Please Log in to join the conversation.

More
5 years 8 months ago #73454 by Mazi
Mazi replied the 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
(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 8 months ago #73472 by tacman1123
tacman1123 replied the 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.

Please Log in to join the conversation.

More
5 years 8 months ago #73474 by TMSWhite
TMSWhite replied the topic: Language detection in template files
There is a {LANG} keyword, so you could do this:
<img src="/images/{if(LANG=='en','en_logo','other_logo')}.png" />

or, since you should know all possible languages your survey uses:
<img src="/images/{LANG}_logo.png" />
The following user(s) said Thank You: tacman1123

Please Log in to join the conversation.

More
5 years 8 months ago #73478 by tacman1123
tacman1123 replied the 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.

Please Log in to join the conversation.

More
5 years 8 months ago #73481 by Mazi
Mazi replied the 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
(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 8 months ago #73498 by TMSWhite
TMSWhite replied the 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.

Please Log in to join the conversation.

More
5 years 8 months ago #73513 by Mazi
Mazi replied the 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
(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
2 years 7 months ago #117984 by jelo
jelo replied the 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.

Please Log in to join the conversation.

More
2 years 7 months ago #117985 by tpartner
tpartner replied the 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.

Please Log in to join the conversation.

More
2 years 7 months ago #117989 by jelo
jelo replied the topic: Language detection in template files
Thanks, wonder why the search wasn't showing that page.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now