Hiding language that is not yet translated

More
1 month 2 weeks ago #196441 by ymca
Hi,

Can I hide a language that is not yet translated or that is not finished yet?
So survey that has full translation in first and second languages, will not show the third language that is not fully translated.

Or that is a feature to ask?

Please Log in to join the conversation.

LimeSurvey Partners
More
1 month 2 weeks ago #196444 by DenisChenu

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 .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 month 2 weeks ago #196466 by ymca

DenisChenu wrote: You can udate the mlanguage changer in theme and create your own.

github.com/LimeSurvey/LimeSurvey/blob/ma...anguage_changer.twig
github.com/LimeSurvey/LimeSurvey/blob/ma...nger_first_page.twig
github.com/LimeSurvey/LimeSurvey/blob/ma...hanger_top_menu.twig

I know, but I think it's problematic.
Because, when I have some surveys that have all translation, when I make a new survey that has less translations, then it will hide all surveys languages and not specific survey translation.

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #196489 by tpartner
If you need it to be survey-specific, edit layout_global.twig to add a survey ID attribute to the <body> tag.

<body style="padding-top: 90px;" class=" {{ aSurveyInfo.class.body }} font-{{  aSurveyInfo.options.font }} lang-{{aSurveyInfo.languagecode}} {{aSurveyInfo.surveyformat}} {% if( aSurveyInfo.options.brandlogo == "on") %}brand-logo{%endif%}" {{ aSurveyInfo.attr.body }} data-sid="{{ aSurveyInfo.sid }}">

Then you can target the language link(s) by survey ID and language.

Either hide it with CSS - something like this in your custom.css file:

body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"] {
	display: none;
}


Or remove it with JavaScript - something like this in your custom.js file:

$(document).on('ready pjax:scriptcomplete',function(){
	$('body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"]').closest('li').remove();
});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 2 weeks ago by tpartner.
The following user(s) said Thank You: DenisChenu, ymca

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #196498 by ymca
Thanks tpartner,
It's all about "Reading comprehension".
I saw it like you writing to me 3 options instead of first doing the "layout_global.twig".
So I've tried to first do the "js" and then tried "css". :laugh:

Then I read it again and understood that I first need the "twig".
Now it's working perfectly B)

Good feature for noobs/translators.

p.s.
What is best place to use for the function?
css or js?
Last edit: 1 month 2 weeks ago by ymca.

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #196511 by tpartner
I would prefer to use the JS as it completely removes the link so it would not be available even to keyboard navigation.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 2 weeks ago by tpartner.

Please Log in to join the conversation.

More
1 month 2 weeks ago #196575 by ymca
Found out it's not working.
If site is in English:
1. starting survey
2. No "pt-BR"

If site is in "pt-BR"
1. Starting survey
2. survey is in "pt-BR"

Please Log in to join the conversation.

More
1 month 2 weeks ago #196588 by DenisChenu

tpartner wrote: I would prefer to use the JS as it completely removes the link so it would not be available even to keyboard navigation.


body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"] {
	display: none;
}
diable keyboard navigation to lang fr too :)

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 .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
1 month 2 weeks ago #196600 by tpartner

If site is in English:
1. starting survey
2. No "pt-BR"

If site is in "pt-BR"
1. Starting survey
2. survey is in "pt-BR"

This workaround only removes the link from the language selector (per your original post) it does not disable the language so, of course, you will be able to access it with a URL parameter.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
1 month 2 weeks ago #196602 by tpartner

DenisChenu wrote:

tpartner wrote: I would prefer to use the JS as it completely removes the link so it would not be available even to keyboard navigation.


body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"] {
	display: none;
}
diable keyboard navigation to lang fr too :)

I need to learn more about keyboard navigation. :)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
1 month 2 weeks ago #196607 by DenisChenu

tpartner wrote: ...

I need to learn more about keyboard navigation. :)

With boostrap

sr-only : keyboard access
hidden : no keyboard access
hidden-md : no keyboard access on Desktops (‚Č•992px) (<1200px)


display : none => no keyboard access
visibility : hidden => no keyboard access

:)

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 .
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: tpartner

Please Log in to join the conversation.

More
4 weeks 1 day ago #197975 by ymca

tpartner wrote: If you need it to be survey-specific, edit layout_global.twig to add a survey ID attribute to the <body> tag.

<body style="padding-top: 90px;" class=" {{ aSurveyInfo.class.body }} font-{{  aSurveyInfo.options.font }} lang-{{aSurveyInfo.languagecode}} {{aSurveyInfo.surveyformat}} {% if( aSurveyInfo.options.brandlogo == "on") %}brand-logo{%endif%}" {{ aSurveyInfo.attr.body }} data-sid="{{ aSurveyInfo.sid }}">

Then you can target the language link(s) by survey ID and language.

Either hide it with CSS - something like this in your custom.css file:

body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"] {
	display: none;
}


Or remove it with JavaScript - something like this in your custom.js file:

$(document).on('ready pjax:scriptcomplete',function(){
	$('body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"]').closest('li').remove();
});


I have been able to hide the Portuguese language from the main site (top right) language chooser, but now I see that the Portuguese language is visible in the left (inner) chooser.
Does this code suppose to hide also the language from the inner language chooser?
Attachments:

Please Log in to join the conversation.

More
4 weeks 17 hours ago #198087 by tpartner
CSS:

body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"],
body[data-sid="123456"] #lang option[value="fr"] {
	display: none;
}

JavaScript:

$(document).on('ready pjax:scriptcomplete',function(){
	$('body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"]').closest('li').remove();
	$('body[data-sid="123456"] #lang option[value="fr"]').remove();
});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: ymca

Please Log in to join the conversation.

More
4 weeks 14 hours ago #198103 by ymca

tpartner wrote: CSS:

body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"],
body[data-sid="123456"] #lang option[value="fr"] {
	display: none;
}

JavaScript:

$(document).on('ready pjax:scriptcomplete',function(){
	$('body[data-sid="123456"] a.ls-language-link[data-limesurvey-lang="fr"]').closest('li').remove();
	$('body[data-sid="123456"] #lang option[value="fr"]').remove();
});

B) Awesome. Thanks.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now