Jump to content

Language Switcher Issues

Recommended Posts

Site URL: https://www.lmtecdigitalsolutions.com/en/home

Hi, my German translated mobile menu seems to have taken on some content from my english translated website. I'm using a language switcher on my website, the main language is English while German is secondary. In both the German and English headers on Desktop view, the two have the correct elements that I want displayed, however when I switch my German translated website into mobile view, the mobile menu has 2 extra elements that are supposed to only be available in the English mobile menu. The way I worded this sounds a bit confusing, so I'll link some screenshots.

The "Industries" and "Offerings" folders/pages shouldn't be inside the German Mobile Menu, but somehow it is. Then if you click on one of them, it sends you to the English webpage.

I want to get rid of those elements in the German Mobile Menu.

Screen Shot 2022-05-28 at 12.11.14 PM.png

Screen Shot 2022-05-28 at 12.11.31 PM.png

Screen Shot 2022-05-28 at 12.11.45 PM.png

Screen Shot 2022-05-28 at 12.11.55 PM.png

Edited by Spence500
Adjusted Title
Link to comment
  • Spence500 changed the title to Language Switcher Issues
  • Replies 4
  • Views 514
  • Created
  • Last Reply

Top Posters In This Topic

First, edit this line

if (lang == "de") {
      $('a[href="/"]').attr("href", "/de/startseite");
   //   $('a[href="/contact"]').text('Kontakt');
   //   $('a[href="/contact"]').attr("href", "/de/kontaktieren");
      $('[data-section-id="6037b4574142e82bebbf3cc6"]').hide();
      $('[data-section-id="6037b464ac60715d509ea18f"]').hide(); 
      
      $('.header-menu-controls-control span:nth-child(2)').text('retour');
    }

to this

if (lang == "de") {
$('body').addClass('body-de');
      $('a[href="/"]').attr("href", "/de/startseite");
   //   $('a[href="/contact"]').text('Kontakt');
   //   $('a[href="/contact"]').attr("href", "/de/kontaktieren");
      $('[data-section-id="6037b4574142e82bebbf3cc6"]').hide();
      $('[data-section-id="6037b464ac60715d509ea18f"]').hide(); 
      
      $('.header-menu-controls-control span:nth-child(2)').text('retour');
    }

Next, add this to Code Injection > Header

<!-- Hide items from DE Pages -->
<style>
  body.body-de div.container.header-menu-nav-item:not(.lang-de) {
    display: none;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 5/29/2022 at 4:59 AM, tuanphan said:

First, edit this line

if (lang == "de") {
      $('a[href="/"]').attr("href", "/de/startseite");
   //   $('a[href="/contact"]').text('Kontakt');
   //   $('a[href="/contact"]').attr("href", "/de/kontaktieren");
      $('[data-section-id="6037b4574142e82bebbf3cc6"]').hide();
      $('[data-section-id="6037b464ac60715d509ea18f"]').hide(); 
      
      $('.header-menu-controls-control span:nth-child(2)').text('retour');
    }

to this

if (lang == "de") {
$('body').addClass('body-de');
      $('a[href="/"]').attr("href", "/de/startseite");
   //   $('a[href="/contact"]').text('Kontakt');
   //   $('a[href="/contact"]').attr("href", "/de/kontaktieren");
      $('[data-section-id="6037b4574142e82bebbf3cc6"]').hide();
      $('[data-section-id="6037b464ac60715d509ea18f"]').hide(); 
      
      $('.header-menu-controls-control span:nth-child(2)').text('retour');
    }

Next, add this to Code Injection > Header

<!-- Hide items from DE Pages -->
<style>
  body.body-de div.container.header-menu-nav-item:not(.lang-de) {
    display: none;
}
</style>

 

Wow, thank you so much my friend, I really appreciate you always helping me out, it works great!

Link to comment
  • 5 months later...
On 10/31/2022 at 9:41 PM, Dimasua said:

Can you please share where are you supposed to edit the line in the code that @tuanphan suggested to edit?

If you have problem, you can describe in detail + share site url, we can help easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.