Facebook Graph API Gender - facebook

Hi I have problem with Facebook Graph API. I'm using it in cordova with this plugin: https://github.com/jeduan/cordova-plugin-facebook4 (I think is not important)
The main problem is value gender. When system language is English I get following value:
gender: "male"
but when my system language is Czech I get following value:
gender: "muž"
and this is problem for me because I expecting for future work "male" or "female"
does anyone now how to figure it out and get always english?
Thanks for any answer

You just have to add the locale to the API call, it would be like this for english:
/me?fields=gender&locale=en_US
Or with the Cordova plugin:
facebookConnectPlugin.api('/me?fields=gender&locale=en_US', ...)

See this for more information about how to use the Graph API.
Written under "Modifying API Requests":
locale
Used if your app needs the ability to retrieve localized content in the language of a particular locale (when available).
So try to set the locale parameter to english.

Related

How can I know the spoken language of the assistant?

I want to know in my fulfillment what was the language the user was spoken when the intent was triggered.
Is there a way to know that? I didn't find that information in the request header or in the request data.
Thanks
Guzman
This information is part of the user locale and is part of the JSON body that is sent. You can get this in one of a few ways:
If you're using the node.js library, you can use app.getUserLocale()
If you're using the Action SDK, this is in the JSON at user.locale
If you're using Dialogflow, this is in the JSON at originalRequest.data.user.locale
In each case, the value returned will be something like en-US specifying the language and locale the user is using.
Keep in mind that you will still need to register your Action to handle these languages or language/locale pairs in the Action console.

facebook places API change city language

I have a question about the Facebook Places API:
https://graph.facebook.com/v2.10/search?type=place
Does anyone know how to get the city name in a different language from Facebook?
If I use a locale in the request, then I still get the english version of the city in the location object:
e.g.
https://graph.facebook.com/v2.10/search?type=place&limit=10&fields=name,category_list,location,phone,website,city&locale=de_DE&q=Petersdom
city is always "Rome". But with the locale "de_DE" it should be "Rom".
Does anyone have experience with it?
thanks

Localized hometown from facebook connect

When using facebook connect with devise, I get the hometown like this:
... hometown=#<Hashie::Mash id="116045151742857" name="Munich, Germany">
locale="de_DE" ...
Is there a way to get each users hometown in his own locale or at least in one set locale (de_DE in my case), e.g. "München, Deutschland" with the facebook API?
I don't want to sport my own database of hometowns if I don't have to.
Note tested, but you could try adding &locale=de_DE to the graph call. You can get the locale from the user object so potentally could customise this per user. Do a "/me" graph call to get the locale, then do a "/me?locale=de_DE" to get it in the user's language.
As I've said, I've not tested so it may not change the content of the field (e.g. Germany -> Allemande) but worth a shot if you've not tried it.

Google Api For Language translation Not Work

Google Api For Language Translation Does Not Work.
i tried
http://ajax.googleapis.com/ajax/services/language/translate?q=hello&v=1.0&langpair=en|fr
TO Convert "hello" From English To French
But It Says:
{"responseData": null, "responseDetails": "Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors", "responseStatus": 403}
List item
So, how can i translate data?
is there another way to translate via calling another web service.
For me your URL gives the following response:
{"responseData": null, "responseDetails": "Please use Translate v2. See http://code.google.com/apis/language/translate/overview.html", "responseStatus": 403}
And on the URL above:
Only paid version of translator API exist since December 2011.
http://code.google.com/apis/language/translate/overview.html

Getting interests and activities in user specific locale via Graph API

we are working on a mobile app that accesses facebook user data.
We want to get the users activities, interests and favorite books, music, etc. We are fetching these information via the Graph API but now we are facing the problem, that the returned interests are in english language.
That are the steps we are taking to fetch common interests:
1) Get access token
2) Call https: //graph.facebook.com/me/interests&access_token=XXX0&locale=de_DE
The response is somewhat like:
{"data":[{"name":"Programming","category":"Interesse","id":"101882226520576","created_time":"2011-08-02T08:38:03+0000"}]}
You can see, that the category is tanslated, but we are also looking for the german version of the name field ("Programmierung").
When i try to access the english "Programming"-page on http://www.facebook.com/pages/Programming/101882226520576 i am forwarded to http://www.facebook.com/pages/Programmieren/106375099398136.
Accessing 106375099398136 with Graph API yields the correct response:
{
"id": "106375099398136",
"name": "Programmieren",
"link": "http://www.facebook.com/pages/Programmieren/106375099398136",
"likes": 6983,
...
}
How do i get this locale dependent link between "Programming"-page and "Programmierung"-page via the Graph API?
just want to share a possible workaround for the above problem.
Basically we are emulating what is happening when the user trys to access a facebook page and is redirected to the localized counterpart. So we are sending a HTTP request to "facebook.com/pages/PAGE_ID" with the user locale set in the HTTP header and follow the redirects until the last location. The URL of the last location is somewhat like "http://www.facebook.com/pages/LOCALIZED_PAGE_NAME/PAGE_ID" and we are extracting the page name from this.
This is an effective but far from efficient solution :) Would appreciate a more elegant way to handle this.
Bye,
Tobias