WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#40656 closed defect (bug) (invalid)

WordPress Facebook integration does not obey locale

Reported by: ChrisBAshton Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: Embeds Keywords:
Focuses: Cc:
PR Number:

Description

It appears that the Facebook integration uses the location of the server WordPress is running on to determine which locale to request from Facebook, rather than obeying the locale configured in the WordPress settings.

---

A client site of mine is hosted in Europe, though its language is set to "en_US", verified by calling:

<?php echo get_locale(); ?>

Despite this, when pulling in a Facebook post, the generated embed code uses the "da_DK" locale.

https://www.facebook.com/loopinglive/posts/426403944363449

=>

https://www.facebook.com/v2.3/plugins/post.php?app_id=&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2F87XNE1PC38r.js%3Fversion%3D42%23cb%3Dfd2d9487a2d664%26domain%3Dwww.loopinglive.com%26origin%3Dhttp%253A%252F%252Fwww.loopinglive.com%252Ff21c512628fd3e8%26relation%3Dparent.parent&container_width=798&href=https%3A%2F%2Fwww.facebook.com%2Floopinglive%2Fposts%2F426403944363449&locale=da_DK&sdk=joey&width=500

Change History (2)

#1 follow-up: @johnbillion
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is probably something you should report to Facebook (good luck), as WordPress is correctly outputting the lang attribute on the html element. Facebook likely uses heuristics to determine if the actual page language is indeed English or not when en_US is used, similar to what Google Chrome does.

This is the unfortunate situation that the web finds itself in when services cannot trust web standards due to incorrect implementations (ie. sites not in US English but still using en_US as the lang).

In your situation you may be able to make use of the og:locale OpenGraph tag to persuade Facebook that your content really is in US English.

#2 in reply to: ↑ 1 @ChrisBAshton
3 years ago

Thanks johnbillion - that makes sense.

Note: See TracTickets for help on using tickets.