On 19/01/2008, Jan Hecking <[EMAIL PROTECTED]> wrote: > To follow up on this somewhat old thread: I finally got around to > actually testing Paolo's suggestion of using the index.php API instead > of api.php. Turns out it doesn't actually work. While the index.php API > does have a variant parameter that allows to select one of the Chinese > language variants (e.g. zh, zh-hk, zh-tw) it does not actually honor > this parameter when combined with action=raw. When returning the raw > Wiki markup it always returns the same variant (zh?) no matter what > variant is specified. > > $ curl -s > "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&action=raw&variant=zh-cn" > > zh-cn > $ curl -s > "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&action=raw&variant=zh-tw" > > zh-tw > $ diff zh-cn zh-tw > > diff shows that the markup returned is identical. With action=view (the > default) the output is clearly different. > > So it looks like there is actually no way to get the raw markup in > different language variants?
This is definitely a bug. I can verify that the variants work with action=render but not with action=raw. Please file a bug report on bugzilla. Andrew Dunbar (hippietrail) > Thanks, > Jan > > > On 12/13/2007 6:45 PM, Jan Hecking wrote: > > On 12/13/2007 11:28 PM, Paolo Liberatore wrote: > > > >> On Thu, 13 Dec 2007, Jan Hecking wrote: > >> > >> > >> > >>> On 12/13/2007 1:04 AM, Roan Kattouw wrote: > >>> > >>> > >>>> Jan Hecking schreef: > >>>> > >>>> > >>>> > >>>>> Hi, > >>>>> > >>>>> Is it possible to retrieve content in different Chinese language > >>>>> variants using the /w/api.php API? There doesn't seem to be a variant or > >>>>> language parameter that would allow selecting a variant like "zh-tw" or > >>>>> "zh-hk". Is there some other way to do this? > >>>>> > >>>>> > >>>>> > >>>> How is this done in the regular user interface, then? > >>>> > >>>> > >>>> > >>> I would like to know that as well. :) > >>> > >>> My suspicion is that the user interface, i.e. the frontend servers, do > >>> the conversion. Which would mean that all users of the MediaWiki API > >>> would have to replicate that work. That would severely limit the use of > >>> the API for Chinese language content IMHO. But then I don't know much > >>> about MediaWiki yet and maybe I have just missed something obvious. > >>> > >>> Thanks, > >>> Jan > >>> > >>> > >>> > >>> > >> There is a "variant" parameter in > >> http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php > >> I believe it's only used for Chinese. > >> > >> > > > > Thanks for the reminder, Paolo! I hadn't considered index.php before > > because I assumed it only returns the rendered HTML markup. But now I > > saw that there is an action=raw parameter which returns the raw wiki > > markup that I'm looking for. However this API has one other drawback: In > > contrast to api.php it doesn't have an option to resolve redirects > > automatically. When calling api.php I was using the redirects parameter > > to do so but this doesn't seem to be supported by index.php when using > > action=raw (only for action=view). That means I would potentially have > > to make multiple calls to resolve redirects manually. Or is there a way > > to avoid this? > > > > Thanks, > > Jan > > > > _______________________________________________ > Mediawiki-api mailing list > [email protected] > http://lists.wikimedia.org/mailman/listinfo/mediawiki-api > -- http://wiktionarydev.leuksman.com http://linguaphile.sf.net _______________________________________________ Mediawiki-api mailing list [email protected] http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
