Last modified: 2011-06-24 17:06:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27375, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25375 - Add canonical namespaces to "wgNamespaceIds" in mw.config
Add canonical namespaces to "wgNamespaceIds" in mw.config
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.20.x
All All
: High normal (vote)
: ---
Assigned To: Krinkle
:
: 29407 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-30 09:41 UTC by lampak
Modified: 2011-06-24 17:06 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description lampak 2010-09-30 09:41:20 UTC
From http://www.mediawiki.org/wiki/Manual:Interface/JavaScript:
wgNamespaceIds - Gives a mapping from namespace names to namespace IDs. For each namespace name, ***including aliases***, the object has one entry that has namespace name as the key and the namespace ID as its integer value. ***Canonical names are not included***.

So it is supposed to contain all aliases but not contain canonical namespaces. It's illogical to me. Canonical namespaces also work as aliases!

I'm writing a script for Polish wikipedia which extracts a link from an article and works out the id of the namespace it leads to. The most straight-forward way would be to extract the namespace from the link and search for it in wgNamespaceIds. But it's not that simple, because the link may contain a namespace in its canonical form. So now I'm going to define my own table, put canonical namespaces to it by hand, merge it with wgNamespaceIds... Quite easy, but not nice.

An alternative solution would be to define a new table with ids of canonical namespace names.
Comment 1 Michael Dale 2010-12-29 03:38:18 UTC
This sounds like something the new resource loader could provide
Comment 2 Krinkle 2011-06-14 22:46:58 UTC
(Cited from bug 29407 comment #0)
> wgNamespaceIds in JavaScript doesn't include canonical namespaces.
> 
> They should be added in a similar way that Language->getNamespaceIds does it
> for the localized namespaces and the namespace aliases.
> 
> Currently problematic in UploadWizard's mw.Title constructor, when
> .setNamespace() is used with a canonical namespace on a non-English
> content-language wiki.
> 
> Example: On a German wiki "var foo = new mw.Title('bar').setNamespace('file')"
> will throw
> 
> Error: Unrecognized canonical namespace: file
> 
> ...since wgNamespaceIds only contains localized namespaces + namespace aliases,
> not canonical ones (which is in contrary to the assumption that has been made
> in various places).
> 
> Assigning to myself, will be fixed together with bug 29397 (integrate mw.Title
> in core)
Comment 3 Krinkle 2011-06-14 22:47:00 UTC
*** Bug 29407 has been marked as a duplicate of this bug. ***
Comment 4 Krinkle 2011-06-14 22:52:46 UTC
Fixed in r90096.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links