Language selector

More
2 months 3 days ago #220532 by Dialogs
Language selector was created by Dialogs
Hello!

I recently noticed that the language selector now displays the language twice: once in the current language and a second time in the language of choice. For example, if I am in a French questionnaire, the language selector will display "English - Anglais" for the English option. What is the best way to display, as in the past, only the language according to the second option (e.g. English for Anglais)?

See attached images as examples. 

Thank you.
Attachments:

Please Log in to join the conversation.

More
2 months 3 days ago #220535 by tpartner
Replied by tpartner on topic Language selector
I don't see why the two languages are a problem. I think it was added as a feature.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
2 months 3 days ago #220536 by Dialogs
Replied by Dialogs on topic Language selector
Thanks for your quick feedback.

Typically on the web, the language selectors only display the language we want to apply the language change to. Also, the display of two labels lengthens the dropdown list. This is not ideal, especially on mobile.

If this is an option, how can we get back to displaying only one language?

Please Log in to join the conversation.

More
2 months 3 days ago #220537 by tpartner
Replied by tpartner on topic Language selector
I don't know whether I agree with your "typically" and I don't see how in increases the length of the select element. There are the same number of option elements.

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 months 3 days ago #220538 by Dialogs
Replied by Dialogs on topic Language selector
It is not the length but rather the width that is more important... and in some cases problematic (display of "...")

Please Log in to join the conversation.

More
2 months 3 days ago #220542 by tpartner
Replied by tpartner on topic Language selector
Extend your theme, edit language_changer_top_menu.twig, changing this:

<!-- Language Changer, top menu version -->
<li class="{{ aSurveyInfo.class.lctli }} dropdown" {{ aSurveyInfo.attr.lctli }} >
	<a class="{{ aSurveyInfo.class.lctla }} dropdown-toggle animate" {{ aSurveyInfo.attr.lctla }} >
 
		{# NOTE:  {{gT( aLCD.aListLang[aLCD.sSelected] )}}: retreives the language name of the selected language and translates it #}
		{{ gT("Language:") }} {{ aLCD.aListLang[aLCD.sSelected] }}
		<span class="{{ aSurveyInfo.class.lctspan }} caret" {{ aSurveyInfo.attr.lctspan }} ></span>
	</a>
 
	<ul class="{{ aSurveyInfo.class.lctdropdown }} dropdown-menu" id="{{ aSurveyInfo.id.lctdropdown }}" {{ aSurveyInfo.attr.lctdropdown }} >
		{# List of available languages.  #}
		{% for value, lang in aLCD.aListLang %}
			<li class="{{ aSurveyInfo.class.lctdropdownli }}" {{ aSurveyInfo.attr.lctdropdownli }}>
				<a href='#' data-limesurvey-lang='{{ value }}' class="{{ aSurveyInfo.class.lctdropdownlia }} animate" {{ aSurveyInfo.attr.lctdropdownlia }}>
					{{gT( lang )}}
				</a>
			</li>
		{% endfor %}
	</ul>
</li>

To this:

<!-- Language Changer, top menu version -->
<li class="{{ aSurveyInfo.class.lctli }} dropdown" {{ aSurveyInfo.attr.lctli }} >
	<a class="{{ aSurveyInfo.class.lctla }} dropdown-toggle animate" {{ aSurveyInfo.attr.lctla }} >
 
		{# NOTE:  {{gT( aLCD.aListLang[aLCD.sSelected] )}}: retreives the language name of the selected language and translates it #}
		{{ gT("Language:") }} {{ aLCD.aListLang[aLCD.sSelected]|split(' - ')[0] }}
		<span class="{{ aSurveyInfo.class.lctspan }} caret" {{ aSurveyInfo.attr.lctspan }} ></span>
	</a>
 
	<ul class="{{ aSurveyInfo.class.lctdropdown }} dropdown-menu" id="{{ aSurveyInfo.id.lctdropdown }}" {{ aSurveyInfo.attr.lctdropdown }} >
		{# List of available languages.  #}
		{% for value, lang in aLCD.aListLang %}
			<li class="{{ aSurveyInfo.class.lctdropdownli }}" {{ aSurveyInfo.attr.lctdropdownli }}>
				<a href='#' data-limesurvey-lang='{{ value }}' class="{{ aSurveyInfo.class.lctdropdownlia }} animate" {{ aSurveyInfo.attr.lctdropdownlia }}>
					{{gT( lang )|split(' - ')[0]}}
				</a>
			</li>
		{% endfor %}
	</ul>
</li>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, holch

Please Log in to join the conversation.

More
2 months 3 hours ago #220681 by Dialogs
Replied by Dialogs on topic Language selector
Thank you very much tpartner for your support :-)

Please Log in to join the conversation.

More
1 month 4 weeks ago #220686 by DenisChenu
Replied by DenisChenu on topic Language selector
{{gT( lang )|split(' - ')[0]}} ?

We rally need a better way to do this in theme

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The following user(s) said Thank You: holch

Please Log in to join the conversation.

More
1 month 4 weeks ago #220687 by tpartner
Replied by tpartner on topic Language selector
Yes, I agree, translations in the them would be a good thing.

However, I thought my solution was fairly clever. :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch, tammo

Please Log in to join the conversation.

More
1 month 4 weeks ago #220705 by DenisChenu
Replied by DenisChenu on topic Language selector
Your solution is really clever !

Sure !

But have another array with (if current is french)

'en' => array(
'current' => "Anglais",
'local'=> "English",
'rtl' =>false,

);

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now