javascript - How to specify the language to be used in the Facebook Login Dialog - Stack Overflow

I'm using the Javascript SDK for facebook to login a user with Facebook:Documentation FB.Login: li

I'm using the Javascript SDK for facebook to login a user with Facebook:

Documentation FB.Login: link

Unfortunatly this dialog is always in English.

FB.Dialog will trigger a popup window with url:

.php?PARAMETERS

With the help of another related question here I found that I can add locale2 parameter:

.php?PARAMETERS&locale2=es_ES

With this extra parameter the dialog is now shown in Spanish.

But I can't find how to pass this language paramter to the FB.Login function so it's also used in the login dialog.

Is there any function known that can help me with this issue?

I'm using the Javascript SDK for facebook to login a user with Facebook:

Documentation FB.Login: link

Unfortunatly this dialog is always in English.

FB.Dialog will trigger a popup window with url:

https://www.facebook./login.php?PARAMETERS

With the help of another related question here I found that I can add locale2 parameter:

https://www.facebook./login.php?PARAMETERS&locale2=es_ES

With this extra parameter the dialog is now shown in Spanish.

But I can't find how to pass this language paramter to the FB.Login function so it's also used in the login dialog.

Is there any function known that can help me with this issue?

Share Improve this question edited May 23, 2017 at 12:33 CommunityBot 11 silver badge asked Feb 8, 2013 at 12:00 ThdKThdK 10.6k23 gold badges79 silver badges103 bronze badges 2
  • developers.facebook./docs/javascript/…. so does not matter what param locale you will pass it is goign to use language provided in user setting profile – Anja Ishmukhametova Commented Aug 10, 2022 at 15:59
  • Now with the version v16, there seems to be no place to change the locale now – Xiao Commented Apr 7, 2023 at 6:26
Add a ment  | 

2 Answers 2

Reset to default 3

It might be something to do with the SDK source you are using

From http://developers.facebook./docs/reference/javascript/

 js.src = "//connect.facebook/en_US/all.js";

Change en_US to your language locale es_ES and that might fix it.

You can set locale while loading Facebook SDK:

   // Load the SDK Asynchronously
    (function (d) {
        var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
        if (d.getElementById(id)) { return; }
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook/en_GB/all.js";
        ref.parentNode.insertBefore(js, ref);
    } (document));

As you can see, in link assigned to js.src there is en_GB part. If you want to load SDK with current user's locale, you can check the locale before loading SDK and then use this here.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745141851a4613466.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信