3

I have an opengraph object https://example.com/object that supports multiple locales, specifically en_US and fr_FR with the first as default.

Parsing it in Facebook's Object Debugger correctly shows both locales as og:locale:alternate properties and the default locale as og:locale. Clicking each locale link indeed shows the object in the expected locale.

However, when a user likes the object (passing https://example.com/object as object url, using any like-box locale, and no matter which locale is defined for the user in Facebook), her stream always shows the object in its default en_US locale.

Is this a Facebook issue, or did I miss anything?

NOTE: This question is similar to this one. However, the focus there is on scraping the URL by Facebook, which works fine for me: both fb_locale and X-Facebook-Locale are correctly passed when the url is scraped. Here, the focus is on displaying the scraped url in the stream using the correct locale

César
  • 9,939
  • 6
  • 53
  • 74
dleshem
  • 43
  • 5

1 Answers1

2

The documentation is a bit confusing.

og:locale shouldn't be set to your default locale; it should be set to whichever locale you're currently returning.

Specifically, if Facebook requests fb_locale=fr_FR, you need to return <meta property="og:locale" content="fr_FR"> in the response.

It does make sense. When Facebook sees og:locale="en_US" in the response, it thinks you didn't have a French page to return, so it uses the English content it's already got. It's just not documented very well at all.

Here are my Open Graph locale tags for English:

<meta property="og:locale" content="en_US" />
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_CA" />

And for French:

<meta property="og:locale" content="fr_CA" />
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_CA" />

On getting Facebook to actually use the right content in a dialog, your mileage may vary, but this will at least get the scraper to recognize your content.

Aaron Adams
  • 1,657
  • 16
  • 23