Carlos
Carlos

Reputation: 13

How to get localizable links with wikipedia API

I am doing one application that uses wikipedia data for show some information.

I have a link to each of the wikipedia topics that I need, but I will localize my app to different languages, so I need to know if there is a way to get links for each language if I have the a link to one language using the Wikipedia API.

Example: In my application I have this link: http://en.wikipedia.org/wiki/Stack_Overflow

I need a safe way to get this links (if exist, if not I will show the english one):

de --> http://de.wikipedia.org/wiki/Stack_Overflow_%28Website%29 es --> http://es.wikipedia.org/wiki/Stack_Overflow pt --> does not exist

Upvotes: 1

Views: 127

Answers (1)

Ainali
Ainali

Reputation: 1631

It is possible to ask for through the API. Here is a request with your example: https://en.wikipedia.org/w/api.php?action=query&prop=langlinks&format=json&llprop=url%7Clangname&titles=Stack%20overflow

Upvotes: 6

Related Questions