MelindaMellukas Posted October 13, 2021 Share Posted October 13, 2021 Site URL: https://cinnamon-chameleon-6wa9.squarespace.com/ Hi, I can't find the right code for the header menu button, I want to translate the call-to-action button. I want it in English to be "Let's talk" and in Estonian version "Küsi pakkumine". My page: https://cinnamon-chameleon-6wa9.squarespace.com/ Link to comment
tuanphan Posted October 15, 2021 Share Posted October 15, 2021 On 10/14/2021 at 2:56 AM, MelindaMellukas said: Site URL: https://cinnamon-chameleon-6wa9.squarespace.com/ Hi, I can't find the right code for the header menu button, I want to translate the call-to-action button. I want it in English to be "Let's talk" and in Estonian version "Küsi pakkumine". My page: https://cinnamon-chameleon-6wa9.squarespace.com/ You mean Kontakt button? 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
MelindaMellukas Posted October 15, 2021 Author Share Posted October 15, 2021 8 hours ago, tuanphan said: You mean Kontakt button? Yes, I changed it to Kontakt right now. English could be then Contact and Estonian (EE) Kontakt. Link to comment
tuanphan Posted October 18, 2021 Share Posted October 18, 2021 On 10/15/2021 at 8:25 PM, MelindaMellukas said: Yes, I changed it to Kontakt right now. English could be then Contact and Estonian (EE) Kontakt. Edit this code /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */ if (lang == "en") { $('a[href="/"]').attr("href", "/en/home/"); } to this /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */ if (lang == "en") { $('a[href="/"]').attr("href", "/en/home/"); $('body').addClass("body-en"); } then add this to last line in Code Injection > Footer <script> $(document).ready(function(){ $("body.body-en a.btn").html(function() { return $(this).html().replace("Kontakt", "Contact"); }); $("body.body-en a.btn").attr('href','/en/contact'); }); </script> This code will rename text + change button url on English Pages 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
MelindaMellukas Posted October 20, 2021 Author Share Posted October 20, 2021 Hi, Thank you! I got it working but when you click on english version menu, its a bit flashy, going quickly from Kontakt to Contact: https://cinnamon-chameleon-6wa9.squarespace.com My code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(function() { /* SETUP MULTI-LANGUAGE */ var defaultLanguage = 'et'; var lang = location.pathname.split("/")[1]; var defaultClass = 'lang-'+defaultLanguage+''; var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']"; if (lang == "et" || 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 == "en") { $('a[href="/"]').attr("href", "/en/home"); $('body').addClass("body-en"); } if (lang == "et") { $('a[href="/"]').attr("href", "/et/home"); $('body').addClass("body-et"); } /* ADD EXCLUSION NAV ITEMS */ $('.exclude-me,.exclude-me a').addClass('exclude'); $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude'); }); $(document).ready(function(){ $("body.body-en a.btn").html(function() { return $(this).html().replace("Kontakt", "Contact"); }); $("body.body-en a.btn").attr('href','/en/contact'); }); </script> Link to comment
tuanphan Posted October 22, 2021 Share Posted October 22, 2021 On 10/20/2021 at 9:18 PM, MelindaMellukas said: Hi, Thank you! I got it working but when you click on english version menu, its a bit flashy, going quickly from Kontakt to Contact: https://cinnamon-chameleon-6wa9.squarespace.com My code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(function() { /* SETUP MULTI-LANGUAGE */ var defaultLanguage = 'et'; var lang = location.pathname.split("/")[1]; var defaultClass = 'lang-'+defaultLanguage+''; var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']"; if (lang == "et" || 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 == "en") { $('a[href="/"]').attr("href", "/en/home"); $('body').addClass("body-en"); } if (lang == "et") { $('a[href="/"]').attr("href", "/et/home"); $('body').addClass("body-et"); } /* ADD EXCLUSION NAV ITEMS */ $('.exclude-me,.exclude-me a').addClass('exclude'); $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude'); }); $(document).ready(function(){ $("body.body-en a.btn").html(function() { return $(this).html().replace("Kontakt", "Contact"); }); $("body.body-en a.btn").attr('href','/en/contact'); }); </script> Try adding this to Design > Custom CSS /* Nav links flash */ .header-nav-list { visibility: hidden; } .header-nav-list .multilanguage { visibility: visible; } 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
MelindaMellukas Posted October 25, 2021 Author Share Posted October 25, 2021 2 hours ago, tuanphan said: Try adding this to Design > Custom CSS /* Nav links flash */ .header-nav-list { visibility: hidden; } .header-nav-list .multilanguage { visibility: visible; } I couldnt get it working like this or im missing smth from the code. Problem is its changing visbily Kontakt to Contact in sthe english menu if you navigate between menu items. https://cinnamon-chameleon-6wa9.squarespace.com/ Link to comment
MelindaMellukas Posted October 27, 2021 Author Share Posted October 27, 2021 I couldnt get it working like this or im missing smth from the code. Problem is its changing visbily Kontakt to Contact in sthe english menu if you navigate between menu items. https://cinnamon-chameleon-6wa9.squarespace.com/ 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