I am trying to localise the pop-up login box shown using FB.login() under the Javascript SDK but the dialog only displays in English. I use the code below to connect:

var facebookScript = "//connect.facebook.net/fr_FR/all.js"
$.ajaxSetup({ cache: true });
$.getScript(facebookScript, function () {
   FB.init({
        appId: SOCIAL_FACEBOOK_APP_ID,
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true  // parse XFBML
    });
    FB.getLoginStatus(function () {
        // At some point here FB.login() is called.
    }, true);
});

I notice that if I take the URL of the login box and add &locale=fr_FR to it I get the desired result.

有帮助吗?

解决方案

Facebook will automatically use the appropriate locale based on information from the users browser and account.

The localized versions of the SDK is mostly to make a few adaptions that need to happen on the third party site, mostly around left-to-right/right-to-left languages, and some labels.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top