Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"sex" field in Users.getInfo in Facebook API

Tags:

facebook

This is a noob question. According to Facebook API documentation, the sex field in Users.getInfo() function returns values based on users' locale. Hence, determine the gender of user is difficult.

Any solution suggested?

like image 476
Raptor Avatar asked Feb 01 '10 09:02

Raptor


1 Answers

1) This isn't an elegant solution, and perhaps there's a better way that uses the API, but what if you manually created a look-up table for different values of 'sex' in different locales? You could try checking out facebook profiles of people from different countries and get the string displayed for their sex. Then, put that into some kind of dictionary data structure that allows you to grab the M-F string pair based on the locale's code (also given by getInfo()). For example en-US => (male, female), ja-JP => (男性, 女性). Of course, you could try using google translate too. After you gathered this data for a handful of the main locales, you'd be more-or-less covered. Maybe someone on the internets already has done it.

Of course, you could try emailing someone who works on the API for these values. The list of locale codes is here http://wiki.developers.facebook.com/index.php/Facebook_Locales .

2) Here is probably a better solution than (1). If you directly query the FQL User table, the value returned in 'sex' will always be English, starting from February 7 2010. More information about that is here: http://wiki.developers.facebook.com/index.php/User_%28FQL%29 . So, perhaps in the future getInfo() will return only English too. Who knows.

3) The answer to your question is also given on this existing post: Facebook FQL user table `sex` field : how to return male/female even the user is using different locale?

like image 58
Benny Jobigan Avatar answered Oct 23 '22 04:10

Benny Jobigan