Page MenuHomePhabricator

mediawiki api action=parse does not support language variants
Closed, DeclinedPublic

Description

Currently the mediawiki api does not support language variants. That means that anything returned from the api from zh.wikipedia.org is not necessarily the right variant. I saw there were previous bugs written regarding the api and variants but those were related to getting the raw wikitext and not the parsed output. Since this is post transform presumably it should be ok to to do variant conversion here.


Version: unspecified
Severity: enhancement

Details

Reference
bz26165

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:24 PM
bzimport set Reference to bz26165.

This works for me. (Assuming the language code of the wiki is one that has variants like zh or sr);

(I'm testing Serbian, because I can't make heads or tails out of Chinese characters, but I can tell the difference between Latin and Cyrillic.)

http://sr.wikipedia.org/w/api.php?action=parse&text=foo&prop=text&disablepp produces "foo" (plus some html). (aka no variant)

http://sr.wikipedia.org/w/api.php?action=parse&text=foo&prop=text&disablepp&uselang=sr-el produces "foo" (aka, the Latin variant is selected)

http://sr.wikipedia.org/w/api.php?action=parse&text=foo&prop=text&disablepp&uselang=sr-ec produces "фоо" (aka Cyrillic variant)

This also works using the page parameter as well. Thus, this is supported via the uselang parameter, so closing works for me.

Thanks for that, I guess this is new in 1.17 which is why it is not in the documentation returned by api.php.

Does it also support &variant=, like index.php uses ?