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

Martin Labuschin picture Martin Labuschin · Jul 17, 2014 · Viewed 7k times · Source

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?

Answer

Tobi picture Tobi · Jul 23, 2014

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

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