M
M
maskin2011-06-21 08:31:37
Facebook
maskin, 2011-06-21 08:31:37

Getting localized city and country name on Facebook?

Hello.
It is necessary to get the name of the city where the user lives in a localized form.
To get the city I use the following url:

<a href="https://graph.facebook.com/">graph.facebook.com/</a>&lt;id_юзера&gt;?locale=ru_RU&access_token=&lt;access_token&gt;&fields=location

returns this json:
{<br/>
 &quot;location&quot;: {<br/>
 &quot;id&quot;: &quot;112313418795468&quot;,<br/>
 &quot;name&quot;: &quot;Donetsk, Ukraine&quot;<br/>
 },<br/>
 &quot;id&quot;: &quot;100000407160933&quot;<br/>
}

Although in my facebook profile the name of the city is written in Russian. Plus, in the profile, when clicking on the city, it goes here www.facebook.com/pages/Donetsk-Ukraine/112313418795468 (that is, exactly the id that is returned via graph api) and then redirects to the Russian version of www.facebook.com/pages/ %D0%94%D0%BE%D0%BD%D0%B5%D1...
Help me understand, please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
ertaquo, 2011-06-21
@ertaquo

Try adding locale=ru_RU to the request:
graph.facebook.com/19292868552 - displays category in English
graph.facebook.com/19292868552&locale=ru_RU - displays category in Russian
should roll.

R
RomeroMsk, 2011-06-21
@RomeroMsk

It seems that so far FB does not provide such an option in its API. The first thing that comes to mind from workarounds (stupidly, but since there are no other options): make a request of the form
api.facebook.com/method/pages.getinfo?fields=page_url&page_ids=112313418795468&access_token=...&format=json
where page_ids is the id of the received locations (instead of this request, you can at least use Graph, at least FQL, it doesn’t matter - I think the point is clear: find a page with the desired id), and then parse the page at the specified page_url (take the value of the title tag, for example).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question