I got this working. The documentation is not very detailed; here are details.
Here are my Open Graph locale tags:
<meta property="og:locale" content="en_US" />
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_CA" />
VERY IMPORTANT: The documentation makes it seem that og:locale
should always reflect the page's "default" locale. This is not the case; doing so will prevent the scraper from retrieving other languages. og_locale
must reflect the page's current locale. In other words, if the scraper (or the user) requests fr_CA
content, make sure og_locale
is set to fr_CA
in the response.
Specify all possible locales with og:locale:alternate
. This way, whether the scraper asked for en_US
or fr_CA
, it still knows that both exist.
Here's me asking the Facebook scraper to re-process my page:
curl -d "id=https://apps.facebook.com/everydaybarilla/&scrape=true" https://graph.facebook.com
Here's the response:
{
"url": "http://apps.facebook.com/everydaybarilla/",
"type": "website",
"title": "Barilla\u2019s Every Day, Every Way Contest",
"locale": {
"locale": "en_us",
"alternate": [
"fr_ca"
]
},
"image": [
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/5.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/4.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/3.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/en-2.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/en-1.png"
}
],
"description": "Barilla Canada is whisking one lucky winner and a guest off to Italy on an 8-day Italian culinary adventure for 2 in the Barilla Every Day, Every Way Contest!",
"site_name": "Barilla\u2019s Every Day, Every Way Contest",
"updated_time": "2012-04-16T17:59:38+0000",
"id": "10150594698421968",
"application": {
"id": "317271281656427",
"name": "Barilla\u2019s Every Day, Every Way Contest",
"url": "http://www.facebook.com/apps/application.php?id=317271281656427"
}
}
The scraper correctly returns the data for the default locale, but according to the documentation, it seems that the scraper should scrape alternate locales as well; this is not the case. Clearly from the response above it sees the alternate locales, but it does not process them.
So, here's me specifically asking the Facebook scraper to process my page en français:
curl -d "id=https://apps.facebook.com/everydaybarilla/&scrape=true&locale=fr_CA" https://graph.facebook.com
This time, I correctly see two requests to my server from the scraper. The second request has both the X-Facebook-Locale
header and the fb_locale
URL parameter correctly set to fr_CA
. And the POST correctly returns the French response:
{
"url": "http://apps.facebook.com/everydaybarilla/?fb_locale=fr_CA",
"type": "website",
"title": "Concours Tous les jours, de toutes les fa\u00e7ons de Barilla",
"locale": {
"locale": "fr_ca",
"alternate": [
"en_us",
"fr_ca"
]
},
"image": [
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/5.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/4.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/3.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/fr-2.png"
},
{
"url": "http://everydaybarilla.ssl.spidermarketing.ca/assets/img/thumbnails/fr-1.png"
}
],
"description": "Un heureux gagnant et son invit\u00e9(e) partiront \u00e0 destination de l\u2019Italie pour une aventure culinaire de 8 jours pour 2 personnes (valeur au d\u00e9tail approximative de 15 000 $)!",
"site_name": "Barilla\u2019s Every Day, Every Way Contest",
"updated_time": "2012-04-16T18:11:27+0000",
"id": "10150594698421968",
"application": {
"id": "317271281656427",
"name": "Barilla\u2019s Every Day, Every Way Contest",
"url": "http://www.facebook.com/apps/application.php?id=317271281656427"
}
}
Success!
Of course, after all this effort, when I go to the French Facebook.com and post this URL, the status box is populated… with the English data. It seems Facebook's own interfaces aren't configured to request the correct locale.
So even with all this effort, nothing seems to have been accomplished (translations of my strings via the Facebook translation app aren't working either, so I guess I shouldn't be surprised).
Still, it does answer the question. Perhaps somebody else can determine why the Facebook.com interfaces don't seem to request the correct locale.