Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

How to set Multi language

$
0
0

Replies: 0

How to set the chatbox Multilanguage

i have 3 language site ‘fr’, ‘de’, ‘en’

here my script please check and suggest

window.$crisp=[];CRISP_RUNTIME_CONFIG ={locale : 'fr'};window.CRISP_WEBSITE_ID="xxxx7666";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();

And below your plugin code

function crisp_hook_head() {
  $website_id = get_option('website_id');
  $locale = str_replace("_", "-", strtolower(get_locale()));

  if (!in_array($locale, array("pt-br", "pt-pr"))) {
    $locale = substr($locale, 0, 2);
  }

  if (!isset($website_id) || empty($website_id)) {
    return;
  }

  $output="<script data-cfasync='false'>
    window.\$crisp=[];
    CRISP_RUNTIME_CONFIG = {
      locale : '$locale'
    };
    CRISP_WEBSITE_ID = '$website_id';";

  $output .= "(function(){
      d=document;s=d.createElement('script');
      s.src='https://client.crisp.chat/l.js';
      s.async=1;d.getElementsByTagName('head')[0].appendChild(s);
    })();";

  $output .= crisp_sync_wordpress_user();
  $output .= crisp_sync_woocommerce_customer();

  $output .= "</script>";
  
  echo $output;
  • This topic was modified 55 minutes ago by gautam143.
  • This topic was modified 55 minutes ago by gautam143.
  • This topic was modified 52 minutes ago by gautam143.
  • This topic was modified 44 minutes ago by gautam143.
  • This topic was modified 42 minutes ago by gautam143.

Viewing all articles
Browse latest Browse all 59525

Trending Articles