Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get localized values from Facebook Open Graph API through Koala?

I am using the koala gem in my rails app to use the Facebook Open Graph API. The primary language of the app is German.

Is there a way to set a locale to get e.g. the user's current city in German? Or is there another reliable wa to translate locations?

like image 806
Martin Labuschin Avatar asked Jul 17 '14 09:07

Martin Labuschin


People also ask

How do I pull data from Facebook?

Just go to the Settings section of Facebook (the arrow next to the question mark, top right) and click on "download my data" at the bottom of the page called "General Account Settings." Then you'll make your request and await Facebook's compiling of your data, which is delivered via an email link.

What is the name of API used for retrieving data from Facebook?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

Is Facebook Graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


1 Answers

The Graph API supports the passing of the locale parameter. For Germany, this would be de_DE.

You can test this via

GET /me?fields=location&locale=de_DE

compared to

GET /me?fields=location&locale=en_GB

Have a look at

  • https://developers.facebook.com/docs/internationalization
  • https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#readmodifiers
  • https://developers.facebook.com/docs/opengraph/guides/internationalization/

Keep in mind that the translations are not always available, especially for OpenGraph objects.

like image 81
Tobi Avatar answered Jan 04 '23 10:01

Tobi