Thanks for your help !
Actually, it's the same for other languages, but the API has a very
specific way to manage languages in request.
To have the datas in different languages, we have to call the langlinks
props in the url, and then do llprop=url to have the url of the page for
each languages. This is the final request I send to the API :
$wikivoyageRequest =
"https://en.wikivoyage.org/w/api.php?action=query&format=json&" //Base
."prop=coordinates|info|langlinks&" //Props list
."inprop=url" //Properties
dedicated to url
."&llprop=url"//Properties
dedicated to langlinks
."&generator=geosearch&ggscoord=$user_latitude|$user_longitude&ggsradius=10000&ggslimit=50";
//Properties dedicated to geosearch
The answer contains every link for every language, so I guess it solves
my problem.
Thanks a lot for helping me, I'll show you my project when it's over ! :)
Le 22/07/2015 15:44, Petr Kadlec a écrit :
On Wed, Jul 22, 2015 at 9:09 AM, Sylvain Arnouts
<sylvain.arnouts(a)wanadoo.fr
wrote:
But I still have some issues. I'm trying to use it in different languages.
It works in english, but I'd like to have results from the french version
of Wikivoyage. I don't know why, it doesn't work by calling
https://fr.wikivoyage.org/w/api.php? ... same request. I've no answer,
even if the page actually exists.
For this feature to work, the page obviously needs to know its coordinates.
The English page does <
https://en.wikivoyage.org/w/api.php?action=query&prop=coordinates&t…
while the French page does not <
https://fr.wikivoyage.org/w/api.php?action=query&prop=coordinates&t…s=Lille>.
The coordinates are stored into the page properties using the
{{#coordinates:}} special function, see <
https://www.mediawiki.org/wiki/Extension:GeoData#Usage>gt;. On English
Wiktionary, this function is called using the {{Geo}} template (see <
https://en.wikivoyage.org/w/index.php?title=Template:Geo&action=edit>)it>). On
the French Wiktionary, the function should probably be called in {{Info
Ville}} or {{Geo}}, I guess.
HTH,
-- [[cs:User:Mormegil | Petr Kadlec]]
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l