• Good day.
    Delivered this plug-in and there was no limit to the joy.
    But I got problematic when switching the language of the chat and the department of the recipients of alerts.
    Namely:
    now solved the issue of switching the language by creating several chats and assigning these chats to different languages.
    1) 3 languages: Rus, Eng, De.
    2) in the function.php file, the variable was ignored in the translation of the lines, each language translated accordingly: Rus, Eng, De.
    3) under them wrote a check on the frontend namely:

    
    <script type="text/javascript">
      var lang= "<?php echo pll__('clang'); ?>";  //clang - variable for Polylang, in which the name of the language is stored
        switch (lang) {
          case "Rus":
            var TawkL='https://embed.tawk.to/-----------/default'; //TawkL - whose variable is assigned a value as a link to the chat widget
            alert ('ru: '+ TawkL);
          break;
          case "Eng":
    	var TawkL='https://embed.tawk.to/-----------/-------eng';
    	alert ('de: '+ TawkL);
          break;
    	case "De":
    	var TawkL='https://embed.tawk.to/-----------/---------de';
          alert= ('en: '+ TawkL);
          break;
        };
      var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
      (function(){
        var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
        s1.async=true;
        s1.src= TawkL;
        s1.charset='UTF-8';
        s1.setAttribute('crossorigin','*');
        s0.parentNode.insertBefore(s1,s0);
      })();
    </script>
    

    And so the events are being worked on as evidenced by (“alert (‘ru: ‘+ TawkL);”) and the change of languages “supposedly” occurs, but after several reloads of the page …
    what could be the problem?

    And the second problem is how to assign a specific chat, a specific department to notify?
    For Renee, thank you for your help!

  • The topic ‘Polylang and tawk.to switch lang chat’ is closed to new replies.