1

I'm displaying the Facebook share button on my website, but it always displays in English, even though I followed the guidelines for using another language.

Here's my code:

<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 = "https://connect.facebook.net/de_DE/sdk.js#xfbml=1&appId=149263621911030&version=v2.0"; 
      fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

As you can see, I want to have the text for the button in German, but it displays in English anyway.

Here's the funny part: If I substitute sdk.js with all.js which, according to Facebook, is deprecated, everything works fine. This is true for at least Swedish, German and Danish, which are the only ones I've tested so far.

Should I be doing something differently to get things to work with the recommended sdk.js, or did Facebook just ditch support for other languages than English in the latest version?

For completeness, the part where I display the Share-button looks like this:

<div class="fb-share-button" data-href="http://adrdangerousgoods.com/ger/" data-width="250" data-layout="button_count"></div>
4
  • To me it looks like you got it right, based on facebook localization docs. Do you have a meta tag which defines at UTF charset or language for the page?
    – Frank
    Commented Oct 1, 2014 at 8:59
  • For Reference: facebook.com/translations/FacebookLocales.xml
    – Frank
    Commented Oct 1, 2014 at 9:00
  • Look at this StackOverflow Answer by David L. stackoverflow.com/questions/6827726/… Looks like the user who is viewing your site needs to have their language set to German for it to work.
    – Frank
    Commented Oct 1, 2014 at 9:01
  • Another interesting sample of using the iframe code (for likes and shares) to force a language.codepen.io/marktopper/pen/eHzis
    – Frank
    Commented Oct 1, 2014 at 9:04

1 Answer 1

1

David L says in How can the language of the Facebook "like" button be changed?:

... the language pointed out in the URL, is for the DEFAULT language of the text. However, if a person has her/his Facebook account already open, such setting is superseded by the default language of THE ACCOUNT'S language. But that will change according to each individual's own settings, which is a desirable behavior.

So while you are specifying the default language for the button, it is always coming up as English for you because you are signed into Facebook with an account set to English as the preferred language. To test it, use private browsing so that it can't access your Facebook account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.