如何通过Koala从Facebook Open Graph API获取本地化值? [英] How to get localized values from Facebook Open Graph API through Koala?

查看:95
本文介绍了如何通过Koala从Facebook Open Graph API获取本地化值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Rails应用程序中使用考拉宝石来使用Facebook Open Graph API. 该应用程序的主要语言是德语.

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?

推荐答案

Graph API支持传递locale参数.对于德国,这将是de_DE.

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

相比

GET /me?fields=location&locale=en_GB

看看

  • 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/

请记住,翻译并不总是可用的,尤其是对于OpenGraph对象.

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

这篇关于如何通过Koala从Facebook Open Graph API获取本地化值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆