Welcome to the LimeSurvey Community Forum

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

Hiding language that is not yet translated

  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months 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?

LS Version 4.2+
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196444 by DenisChenu
Replied by DenisChenu on topic Hiding language that is not yet translated

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 topic has been locked.
  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months 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.

LS Version 4.2+
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #196489 by tpartner
Replied by tpartner on topic Hiding language that is not yet translated
If you need it to be survey-specific, edit layout_global.twig to add a survey ID attribute to the <body> tag.

Code:
<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:

Code:
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:

Code:
$(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.
Last edit: 3 years 11 months ago by tpartner.
The following user(s) said Thank You: DenisChenu, ymca
The topic has been locked.
  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months ago - 3 years 11 months 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?

LS Version 4.2+
Last edit: 3 years 11 months ago by ymca.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #196511 by tpartner
Replied by tpartner on topic Hiding language that is not yet translated
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.
Last edit: 3 years 11 months ago by tpartner.
The topic has been locked.
  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months 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"

LS Version 4.2+
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196588 by DenisChenu
Replied by DenisChenu on topic Hiding language that is not yet translated

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.


Code:
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 .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196600 by tpartner
Replied by tpartner on topic Hiding language that is not yet translated

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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196602 by tpartner
Replied by tpartner on topic Hiding language that is not yet translated

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.


Code:
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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196607 by DenisChenu
Replied by DenisChenu on topic Hiding language that is not yet translated

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 .
I don't answer to private message.
The following user(s) said Thank You: tpartner
The topic has been locked.
  • ymca
  • ymca's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 11 months 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.

Code:
<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:

Code:
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:

Code:
$(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?

LS Version 4.2+
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose