Topic on API talk:Langlinks

Dalba (talkcontribs)

Is it possible for a language code to have more than one language link? The current API help states that the lllang parameter causes the API to "only return language links with this language code". That "links" makes one think that the API may return multiple links for an individual language code, but I cant think of any situation or example that it would be the case.

I tried to manually add a language link to (different that the one that was already stored at wikidata), but it just overrode the previous language link and the API was still returning only one link.

RobinHood70 (talkcontribs)

Yup, there it is. If you look at Manual:Langlinks table, you'll see that the primary key ("PRI" in the Key column) is based on the page_id and the language link. Therefore, it's guaranteed that there can only ever be one result for a given language.

RobinHood70 (talkcontribs)

Nevermind, you already tried that. I didn't read closely enough. :) My guess is that it will probably only ever return one value, but that's just a guess. I don't see anything in the API that would preclude multiple language links being returned for the same language, but there could be something in how the table itself is populated that precludes it.

Sette-quattro (talkcontribs)
RobinHood70 (talkcontribs)

The parameter doesn't seem to be set up as a multi-input parameter. About the only way I can see of doing what you want is to drop the lllang parameter altogether (and optionally add lllimit=500), which will return all the language links. Then, you can filter those results to just French and Italian.

Sette-quattro (talkcontribs)

Thanks!

Reply to "lllang"