Last modified: 2012-04-04 19:33:04 UTC
The {{NAMESPACE}} variable always give the namespace text, but this text can change, due to a configuration or localisation change. Having a way to get the namespace number makes it possible to avoid a breaking of conditions or transclusion by a change of a namespace. Using {{NAMESPACE}} and {{ns:0}} inside a #ifeq does not have this problem, but when using the {{NAMESPACE}} in transclusion of a page, you have this problem or you have to use a big switch to map the name against the number, but getting the number direct from MediaWiki sounds better. Please add a {{NAMESPACENUMBER}} variable and also a parser function {{NAMESPACENUMBER:pagename}} (like NAMESPACE). Maybe call it NAMESPACEID, I am not sure, which is a better name. Thanks.
I'm a bit leery of this because the ids may become much more variable in the future... but it's probably not a problem to do.
Useful situation for NAMESPACENUMBER: https://de.wikipedia.org/w/index.php?title=MediaWiki:Flaggedrevs-categoryview&diff=99966481
Workaround: [[de:Vorlage:NAMESPACENUMBER]]
Commited a patch with Gerrit change #4056
successfully merged by Brion