5

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?

Martin Labuschin
  • 516
  • 4
  • 16

1 Answers1

12

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.

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • Good start! Thanks! But i didnt find any configuration of Koala to set the locale as described :( – Martin Labuschin Jul 23 '14 at 14:31
  • According to https://github.com/arsduo/koala/blob/master/lib/koala/api/graph_api.rb#L40 you should be able to pass `locale=de_DE` as argument to the `get_object()` call. I'm not a Ruby expert... – Tobi Jul 23 '14 at 14:50
  • 1
    https://developers.facebook.com/docs/opengraph/guides/internationalization/ is no longer working – torbenrudgaard Jun 27 '18 at 12:11