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

一世执手 提交于 2019-12-22 06:22:11

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/24799608/how-to-get-localized-values-from-facebook-open-graph-api-through-koala

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!