Last modified: 2012-04-16 09:15:49 UTC
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.
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 ?
(In reply to comment #3) > Does it also support &variant=, like index.php uses ? seems it does. http://sr.wikipedia.org/w/api.php?action=parse&text=foo&prop=text&disablepp&variant=sr-el http://sr.wikipedia.org/w/api.php?action=parse&text=foo&prop=text&disablepp&variant=sr-ec