简体   繁体   中英

Facebook - Share dialog, change language

I'm using facebook sdk:

window.fbAsyncInit = function() {
    FB.init({
         appId      : 'appid',
         xfbml      : true,
         version    : 'v2.2'
    });
};

(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/sv_SE/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));

Share code:

window.open('https://www.facebook.com/dialog/feed?app_id=id&display=popup&link=' + url + '&redirect_uri=' + red_url + '&caption=domain.com', 'Facebook', 'height=320, width=640, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')

When i use this with with their share dialog it looks like this: 脸书分享

Note that the language is in english, how can I change this so it follows the correct language?

The feed dialog is deprecated, you should not use it anymore. Use the Share Dialog instead: https://developers.facebook.com/docs/sharing/reference/share-dialog

By using FB.ui , it will take the language from the included SDK. You are trying to open a window with no connection to your page.

Not recommended, but if you really want to use the old feed dialog, this would be the correct way:

FB.ui({
    method: 'feed',
    link: 'absolute url',
    name: 'some title',
    caption: '---',
    description: 'some description',
    picture: 'absolute url to share pic'
}, callbackFunction);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM