Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Example: https://github.com/huggle/huggle3-qt-lx/blob/master/huggle/wikipage.hpp
//! Namespaces enum MediaWikiNS { MediaWikiNS_Main, MediaWikiNS_Talk, MediaWikiNS_Project, MediaWikiNS_ProjectTalk, MediaWikiNS_User, MediaWikiNS_UserTalk, MediaWikiNS_Help, MediaWikiNS_HelpTalk, MediaWikiNS_Category, MediaWikiNS_CategoryTalk, MediaWikiNS_Mediawiki, MediaWikiNS_MediawikiTalk, MediaWikiNS_File, MediaWikiNS_FileTalk, MediaWikiNS_Portal, MediaWikiNS_PortalTalk, MediaWikiNS_Special };
Is there a way to retrieve:
* Namespace original name (the english one which can be used on any language wiki, like User or Talk) and its talk id * Namespace localized name and its talk id (User talk for User) * Namespace ID
for every namespace that is known by a wiki?
http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=...
On Thu, Nov 21, 2013 at 6:57 AM, Petr Bena benapetr@gmail.com wrote:
Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Example: https://github.com/huggle/huggle3-qt-lx/blob/master/huggle/wikipage.hpp
//! Namespaces enum MediaWikiNS { MediaWikiNS_Main, MediaWikiNS_Talk, MediaWikiNS_Project, MediaWikiNS_ProjectTalk, MediaWikiNS_User, MediaWikiNS_UserTalk, MediaWikiNS_Help, MediaWikiNS_HelpTalk, MediaWikiNS_Category, MediaWikiNS_CategoryTalk, MediaWikiNS_Mediawiki, MediaWikiNS_MediawikiTalk, MediaWikiNS_File, MediaWikiNS_FileTalk, MediaWikiNS_Portal, MediaWikiNS_PortalTalk, MediaWikiNS_Special };
Is there a way to retrieve:
- Namespace original name (the english one which can be used on any
language wiki, like User or Talk) and its talk id
- Namespace localized name and its talk id (User talk for User)
- Namespace ID
for every namespace that is known by a wiki?
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
That one in xml was better readable :P but thanks
On Thu, Nov 21, 2013 at 1:01 PM, John phoenixoverride@gmail.com wrote:
http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=...
On Thu, Nov 21, 2013 at 6:57 AM, Petr Bena benapetr@gmail.com wrote:
Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Example: https://github.com/huggle/huggle3-qt-lx/blob/master/huggle/wikipage.hpp
//! Namespaces enum MediaWikiNS { MediaWikiNS_Main, MediaWikiNS_Talk, MediaWikiNS_Project, MediaWikiNS_ProjectTalk, MediaWikiNS_User, MediaWikiNS_UserTalk, MediaWikiNS_Help, MediaWikiNS_HelpTalk, MediaWikiNS_Category, MediaWikiNS_CategoryTalk, MediaWikiNS_Mediawiki, MediaWikiNS_MediawikiTalk, MediaWikiNS_File, MediaWikiNS_FileTalk, MediaWikiNS_Portal, MediaWikiNS_PortalTalk, MediaWikiNS_Special };
Is there a way to retrieve:
- Namespace original name (the english one which can be used on any
language wiki, like User or Talk) and its talk id
- Namespace localized name and its talk id (User talk for User)
- Namespace ID
for every namespace that is known by a wiki?
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
How about this?
https://translatewiki.net/w/api.php?action=query&meta=siteinfo&sipro...
Example:
<ns id="14" case="first-letter" subpages="" canonical="Category" xml:space="preserve">Category</ns> <ns id="1230" case="first-letter" subpages="" canonical="Mifos" content="" xml:space="preserve">Mifos</ns>
Cheers!
Siebrand
On Thu, Nov 21, 2013 at 5:27 PM, Petr Bena benapetr@gmail.com wrote:
Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Example: https://github.com/huggle/huggle3-qt-lx/blob/master/huggle/wikipage.hpp
//! Namespaces enum MediaWikiNS { MediaWikiNS_Main, MediaWikiNS_Talk, MediaWikiNS_Project, MediaWikiNS_ProjectTalk, MediaWikiNS_User, MediaWikiNS_UserTalk, MediaWikiNS_Help, MediaWikiNS_HelpTalk, MediaWikiNS_Category, MediaWikiNS_CategoryTalk, MediaWikiNS_Mediawiki, MediaWikiNS_MediawikiTalk, MediaWikiNS_File, MediaWikiNS_FileTalk, MediaWikiNS_Portal, MediaWikiNS_PortalTalk, MediaWikiNS_Special };
Is there a way to retrieve:
- Namespace original name (the english one which can be used on any
language wiki, like User or Talk) and its talk id
- Namespace localized name and its talk id (User talk for User)
- Namespace ID
for every namespace that is known by a wiki?
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Yes:
https://pl.wikipedia.org/wiki/Specjalna:ApiSandbox#action=query&meta=sit...
The mapping to talk namespace id is not given, but the talk id is always equal to content id + 1.
On 11/21/2013 06:57 AM, Petr Bena wrote:
Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Of course:
https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop...
- Namespace original name (the english one which can be used on any
language wiki, like User or Talk) and its talk id
This is called the "canonical" namespace name.
- Namespace localized name
This is the text inside each XML element (the '*' key if using JSON).
and its talk id (User talk for User)
Subject namespace IDs are even; talk namespace IDs are odd. You can assume that the ID of the talk namespace is that of the subject namespace plus one. The name for the talk namespace can then be found exactly as for the subject namespace.
However, this applies only to namespaces usable by actual wiki pages. The "Special" and "Media" namespaces, which have IDs less than NS_MAIN (0), have no "Special talk" and "Media talk" counterparts.
- Namespace ID
This is the "id" attribute.
Thank you all. This is perfect solution.
On Thu, Nov 21, 2013 at 1:31 PM, Kevin Israel pleasestand@live.com wrote:
On 11/21/2013 06:57 AM, Petr Bena wrote:
Hi,
Is there some effective way to retrieve a list of namespaces for a wiki? In huggle we have that hardcoded now, but that kind of suck, because every wiki can have some custom NS.
Of course:
https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop...
- Namespace original name (the english one which can be used on any
language wiki, like User or Talk) and its talk id
This is called the "canonical" namespace name.
- Namespace localized name
This is the text inside each XML element (the '*' key if using JSON).
and its talk id (User talk for User)
Subject namespace IDs are even; talk namespace IDs are odd. You can assume that the ID of the talk namespace is that of the subject namespace plus one. The name for the talk namespace can then be found exactly as for the subject namespace.
However, this applies only to namespaces usable by actual wiki pages. The "Special" and "Media" namespaces, which have IDs less than NS_MAIN (0), have no "Special talk" and "Media talk" counterparts.
- Namespace ID
This is the "id" attribute.
-- Kevin Israel - MediaWiki developer, Wikipedia editor http://en.wikipedia.org/wiki/User:PleaseStand
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Well, not really perfect. Not all extensions define the English names for their namespaces as canonical, so there is no clear mapping (this used to be the case for ProofreadPage). Hopefully however that's decreasing.
Nemo
wikitech-l@lists.wikimedia.org