Javascript Facebook“喜欢”按钮的语言如何更改?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6827726/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 23:20:54  来源:igfitidea点击:

How can the language of the Facebook "like" button be changed?

javascriptfacebookfacebook-like

提问by culter

I use Facebook like button on my web page with Facebook comments plugin and until now it works oK. Today I realized that it displays in three different languages (English, Czech and Slovak) in three different browsers. The problem is with different width of each language. Here I've tried to change en_US to sk, but with no effect:

我在我的网页上使用 Facebook 喜欢按钮和 Facebook 评论插件,直到现在它工作正常。今天我意识到它在三种不同的浏览器中以三种不同的语言(英语、捷克语和斯洛伐克语)显示。问题在于每种语言的宽度不同。在这里,我尝试将 en_US 更改为 sk,但没有效果:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script src="http://connect.facebook.net/en_US/all.js"></script>

回答by tomasbarrios

Change your script request to one supported by FB. In my case, i switched form english to spanish bo doing this:

将您的脚本请求更改为 FB 支持的脚本请求。就我而言,我将形式英语切换为西班牙语 bo 这样做:

before

js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";

after

 js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1";

Available options in

中的可用选项

https://www.facebook.com/translations/FacebookLocales.xml

https://www.facebook.com/translations/FacebookLocales.xml

回答by David L

As @tomasbarrios already said, the language pointed out in the URL, 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.

正如@tomasbarrios 已经说过的,URL 中指出的语言是文本的默认语言。但是,如果一个人已经打开了她/他的 Facebook 帐户,则该设置将被帐户语言的默认语言取代。但这会根据每个人自己的设置而改变,这是一种可取的行为。

To add to the already good note by @tomasbarrios , I add this complementary link, that might help you contextualize, that Facebook's official docs don't offer a better list for that: https://developers.facebook.com/docs/internationalization#locales(a typical case of a poor official documentation...)

为了添加到@tomasbarrios 已经很好的注释中,我添加了这个补充链接,这可能会帮助您了解上下文,Facebook 的官方文档没有为此提供更好的列表:https: //developers.facebook.com/docs/internationalization #locales(一个糟糕的官方文档的典型案例...)

In the site blogtricks you will find a better reading than that of the official documentation, at least for beginners in this specific point: http://www.mybloggertricks.com/2011/06/facebook-like-and-send-button-in-108.html

在网站 blogtricks 中,您会发现比官方文档更好的阅读材料,至少对于初学者而言是这样:http://www.mybloggertricks.com/2011/06/facebook-like-and-send-button- in-108.html