Allow some control of the "sharing" UI language for Facebook

Created on 1 December 2017, over 6 years ago
Updated 24 January 2023, over 1 year ago

When sharing a Facebook post, the UI language presented (all the buttons that are part of the embedded FB UI) is based on the hosting server's geographical location, which for us Europeans is often not a good fit (I'm hosting a Dutch site on a German server, so the FB UI is in German)

I posted an issue on the embed/embed Github, but technically they provide enough API that the calling application/module is capable of adjusting this.

https://github.com/oscarotero/Embed/issues/251

I'd suggest that the most sensible approach would be to match the content language for the content in which the url is embedded when calling Facebook?

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium bdeclerc Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States briantschu

    I'm attaching a patch that should cause Facebook embeds to match the language of the page the content is embedded on.

    I used some code that oscarotero shared in an Issue in the Embed repository to provide an 'Accept-Language' header as a starting point:

    $embed = new Embed();
    $embed->getCrawler()->addDefaultHeaders(['Accept-Language' => 'it-IT']);
    

    This patch uses the Language Manager service to get the content language and pass the value in the header.

Production build 0.69.0 2024