tonton Posted February 27, 2023 Share Posted February 27, 2023 Hi my language switcher that is applie in the footer code injection doesnt load the updated enlighs page. i have updated the english homepage with new content but it doesn't load the updated site. I tried changing the code without any luck. Does anyone have and idea? Here is the code that is use for the language switcher in footer. <script> $(function() { /* SETUP MULTI-LANGUAGE */ var defaultLanguage = 'sv'; var lang = location.pathname.split("/")[1]; var site = location.pathname.split("/")[2]; var defaultClass = 'lang-'+defaultLanguage+''; var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']"; if (lang == "" || lang.length > 2 ){ var lang = defaultLanguage; } /* ADD LANGUAGE CLASSES */ $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+''); $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () { var langType = $(this).attr('href').split("/")[1]; var multiLanguageClass = 'multilanguage lang-' + langType + ''; if (undefined !== langType && langType.length <= 2) $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass); }); $('nav button').each(function () { var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0]; var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + ''; if (undefined !== langTypeFolder && langTypeFolder.length <= 2) $(this).addClass(multiLanguageClass); }); /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */ if (lang == "sv") { $('a[href="/"]').attr("href", "/sv/home/"); } /* ADD EXCLUSION NAV ITEMS */ $('.exclude-me,.exclude-me a').addClass('exclude'); $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude'); /* REMOVE OTHER LANGUAGES AND KEEP EXCLUDED ITEMS */ $('.multilanguage:not(".lang-'+lang+',.exclude")').remove(); /*Tiego Cloud länk. Kommentera bort denna om det strular */ /* $('a[href="https://web.tiego.se/"]').css('visibility','visible');*/ /* $('a[href="https://web.tiego.se/"]').addClass('exclude');*/ /* KEEP LINK */ if (lang == "sv") { $('a[href="https://web.tiego.se/"]').addClass('exclude'); } if (lang == "en") { $('a[href="https://web.tiego.se/"]').addClass('exclude'); } /* SETUP LANGUAGE SWITCHER */ $('body').prepend('<div class="language"><a href="https://tiego.se/sv/home/" class="lang-en">Svenska</a> | <a href="https://tiego.eu/en/home" class="lang-sv">English</a></div>'); /* NOT REQUIRED */ /* SETUP URL REROUTE FOR MATCHING LANGUAGE PAGE */ switch (window.location.pathname) { case '/en/about': $(".language a.lang-en").attr("href", "/en/about"); $(".language a.lang-es").attr("href", "/sv/about"); break; case '/sv/about': $(".language a.lang-en").attr("href", "/en/about"); $(".language a.lang-es").attr("href", "/sv/about"); break; case '/en/products': $(".language a.lang-en").attr("href", "/en/products"); $(".language a.lang-es").attr("href", "/sv/products"); break; case '/sv/products': $(".language a.lang-en").attr("href", "/en/products"); $(".language a.lang-es").attr("href", "/sv/products"); break; } }); </script> Kind regards, Tony Link to comment
tuanphan Posted March 5, 2023 Share Posted March 5, 2023 Hi, What is your site url? 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
tonton Posted March 6, 2023 Author Share Posted March 6, 2023 https://mouse-chimes-a658.squarespace.com/en/home Link to comment
tuanphan Posted March 8, 2023 Share Posted March 8, 2023 The content shows fine to me. You try checking it again https://mouse-chimes-a658.squarespace.com/sv/home/ https://mouse-chimes-a658.squarespace.com/en/home Also, I found a strange thing, when clicking on logo on EN Pages, it redirects to this url https://mouse-chimes-a658.squarespace.com/fr/accueil 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
tonton Posted March 9, 2023 Author Share Posted March 9, 2023 Thanks for the feedback. I found the issue. The previous developer had installed an third-party service for the translation which they had canceled. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment