Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook messenger plugin is changing language

I inserted fb messenger plugin code in my website. Whenever I am clicking this plugin, the language changes. I am not using VPN. I also checked my IP address and it is located in my country. Even on mobile device, the language changes.

screenshot of facebook messenger plugin on live site

like image 250
jmozzart Avatar asked Oct 29 '25 09:10

jmozzart


1 Answers

This helped me. I changed URL in SDK code the js.src parameter from:

js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';

To:

js.src = 'https://connect.facebook.net/en/sdk/xfbml.customerchat.js';

Notice that in the first URL there is /en_US/ and in the second there is only /en/. Now I have Facebook chat in english. Still better than random foreign language. I'm following this thread for better solution.

My code:

  <!-- Load Facebook SDK for JavaScript -->
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        xfbml            : true,
        version          : 'v4.0'
      });
    };

    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = 'https://connect.facebook.net/en/sdk/xfbml.customerchat.js';
    //js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));</script>


  <!-- Your customer chat code -->

  <div class="fb-customerchat"
    attribution=setup_tool
    page_id="{Your page id}"
    theme_color="{Your theme color}"
    logged_in_greeting="Hi! How can we help you?"
    logged_out_greeting="Hi! How can we help you?">
  </div>
like image 121
TongaLife Avatar answered Oct 31 '25 13:10

TongaLife