Search code examples
localefacebook-opengraph

Like button seemingly disregards og:locale setting


I have

<html lang="en">

and

<meta property="og:locale" content="da_DK" />

The facebook debugger says under "object properties"

og:locale: da_dk

Based on this information the like button renders in Swedish, which is probably taken from my browser. I would expect, and like, it to respect the og:locale. I have probably missed something simple, but I don't get it, what am I doing wrong?


Solution

  • The like button renders in the language you used in the url to all.js. My example below use en_US for the locale.

    <div id="fb-root"></div>
    <script>(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 = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>