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?
I checked the auto-generated API docs and the API:* articles but could not find any hint on how to do this. I'm using an API call like this to retrieve the article content: http://zh.wikipedia.org/w/api.php?redirects&action=query&prop=revisi...
Thanks, Jan
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?
Roan Kattouw (Catrope)
Roan Kattouw writes:
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?
Roan Kattouw (Catrope)
I think it's done using something in $wgContLang --VasilievVV
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
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.
Paolo [[User:Tizio]]
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
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
On Fri, 14 Dec 2007, Jan Hecking wrote:
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
You never need to call it more than twice, because a redirect that points to another redirect is in fact non-functional in the regular interface. I don't think there is a way to make index.php automatically redirect with action=raw; however, you can also use action=render (this is also compatible with the 'redirect' argument, I'll fix the MW page).
Paolo
Please note that the API follows unlimited number of redirects (taking care of the circular ones), although this is mostly irrelevant to this discussion. --Yuri
On Dec 14, 2007 10:37 AM, Paolo Liberatore Paolo.Liberatore@dis.uniroma1.it wrote:
On Fri, 14 Dec 2007, Jan Hecking wrote:
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
You never need to call it more than twice, because a redirect that points to another redirect is in fact non-functional in the regular interface. I don't think there is a way to make index.php automatically redirect with action=raw; however, you can also use action=render (this is also compatible with the 'redirect' argument, I'll fix the MW page).
Paolo
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
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&ac..."
zh-cn
$ curl -s "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&ac..."
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?
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
On 19/01/2008, Jan Hecking jhecking@yahoo-inc.com 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&ac..."
zh-cn
$ curl -s "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&ac..."
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 Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Jan Hecking 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&ac..."
zh-cn
$ curl -s "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&ac..."
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?
Thanks, Jan
I think it's due there's only one raw markup. The variant is chosen later for display. So you should locally perform that work (you'll need some Mediawiki: messages).
On 1/20/2008 5:11 AM, Platonides wrote:
Jan Hecking 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&ac..."
zh-cn
$ curl -s "http://zh.wikipedia.org/w/index.php?title=%E8%A5%BF%E6%81%A9%E5%A1%94&ac..."
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?
Thanks, Jan
I think it's due there's only one raw markup. The variant is chosen later for display. So you should locally perform that work (you'll need some Mediawiki: messages).
Can someone on this list confirm whether the action=raw method of the index.php API is supposed to support the variant parameter or not?
If not then we have to either do the transcoding client-side or use the rendered HTML instead of the raw wiki markup. Both of these options don't sound very good.
Thanks, Jan
Jan Hecking schreef:
Can someone on this list confirm whether the action=raw method of the index.php API is supposed to support the variant parameter or not?
If not then we have to either do the transcoding client-side or use the rendered HTML instead of the raw wiki markup. Both of these options don't sound very good.
I don't really have the final answer to this, but I do know what action=raw does internally: read an article's wikitext from the database and output it without any processing. In that sense, one could say action=raw isn't supposed to support variants, as it dumps the *raw* wikitext content of an article. On the other hand, the alternatives kind of suck, so I guess action=raw should support variants anyway. Has this bug been filed at Bugzilla yet? If not, please do so.
Roan Kattouw (Catrope)
On 30/01/2008, Roan Kattouw roan.kattouw@home.nl wrote:
Jan Hecking schreef:
Can someone on this list confirm whether the action=raw method of the index.php API is supposed to support the variant parameter or not?
If not then we have to either do the transcoding client-side or use the rendered HTML instead of the raw wiki markup. Both of these options don't sound very good.
I don't really have the final answer to this, but I do know what action=raw does internally: read an article's wikitext from the database and output it without any processing. In that sense, one could say action=raw isn't supposed to support variants, as it dumps the *raw* wikitext content of an article. On the other hand, the alternatives kind of suck, so I guess action=raw should support variants anyway. Has this bug been filed at Bugzilla yet? If not, please do so.
It kind of makes sense both ways. Technically there is only one raw wikitext but pragmatically you should be able to get unrendered versions of either language variant.
The solutions I can think of are:
* something such as "action=rawvariant"
* "action=raw&variant=xxx" which would pragmatically generate a raw equivalent of the variant which would not technically be the raw one
* implement "raw" or "wikitext" in api.php which would be a pragmatic interface that either gives you the technically raw original wikitext or generates a variant wikitext based on the raw wikitext processed by the language variant code.
Stubbornly stating "language variants are not raw wikitext" instead of providing a solutions would be a bad thing (-:
As an alternative, think about what you need the raw wikitext for. Can you not parse or process either the action=render HTML or the same converted to plain text?
Andrew Dunbar (hippietrail)
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
On 1/30/2008 11:05 PM, Roan Kattouw wrote:
Andrew Dunbar schreef:
- "action=raw&variant=xxx" which would pragmatically generate a raw
equivalent of the variant which would not technically be the raw one
That's probably the way to go. I'll start implementing this.
Roan Kattouw (Catrope)
Cool!
Do you have a rough estimate how much effort this is to implement and how long it might take?
Also how long does it usually take from the time a new feature lands in CVS to the time it is available on the live wikipedia servers? From some other posts on this lists I got the impression that it can take a long time - but I don't know whether this means weeks, months or years. :)
Thanks a lot! Jan
On Thu, Jan 31, 2008 at 12:33 PM, Jan Hecking jhecking@yahoo-inc.com wrote:
Also how long does it usually take from the time a new feature lands in CVS to the time it is available on the live wikipedia servers? From some other posts on this lists I got the impression that it can take a long time - but I don't know whether this means weeks, months or years. :)
That depends. Features that do not require schema changes and do not have huge effects are usually live within a few days. However since the weekend is coming, it will probably next week.
Bryan
On 1/30/2008 6:46 PM, Roan Kattouw wrote:
Jan Hecking schreef:
Can someone on this list confirm whether the action=raw method of the index.php API is supposed to support the variant parameter or not?
If not then we have to either do the transcoding client-side or use the rendered HTML instead of the raw wiki markup. Both of these options don't sound very good.
I don't really have the final answer to this, but I do know what action=raw does internally: read an article's wikitext from the database and output it without any processing. In that sense, one could say action=raw isn't supposed to support variants, as it dumps the *raw* wikitext content of an article. On the other hand, the alternatives kind of suck, so I guess action=raw should support variants anyway. Has this bug been filed at Bugzilla yet? If not, please do so.
Roan Kattouw (Catrope)
Yes, I filed a bug for this already: http://bugzilla.wikimedia.org/show_bug.cgi?id=12683
Thanks, Jan
mediawiki-api@lists.wikimedia.org