Embedded content language not respecting Accept-Language anymore

Created on 21 June 2021, about 3 years ago
Updated 5 September 2023, about 1 year ago

Problem/Motivation

To prevent loading facebook content in different language than the current site language, the langcode is passed in Accept-Language header #3014225: Facebook embed does not use current website language β†’ . Now, it doesn't seem to work since the the oEmbed product has been replaced with the oEmbed Read feature by Facebook. According to the documentation (https://developers.facebook.com/docs/graph-api/reference/oembed-video/), the language needs to be passed in the URL as the sdklocale query parameter. Its value should be ll_CC format which is a problem because Drupal doesn't give us the country code in the language ID. For example it gives en instead of en_US, hu instead of hu_HU, nl instead of nl_BE, etc. If we only give the langcode that Drupal presents us, Facebook will always return the result in en_US.

Steps to reproduce

Proposed resolution

Pass the language code in the URL. We need an associative array in the FacebookFetcher class that can be used for getting the proper langcode that Facebook accepts. For example like this:

protected $langcodes = [
  'en' => 'en_US',
  'hu' => 'hu_HU',
  'nl' => 'nl_BE',
];

I found the compatible langcodes list here: https://developers.facebook.com/docs/messenger-platform/messenger-profil...

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

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.

Production build 0.71.5 2024