Ahoj,
make it working with namespaces in non-english wikis. I'm not sure if it is correct, but working for me.
static function getNamespaceNumber ( $ns ) {
global $wgCanonicalNamespaceNames;
global $wgContLang;
// foreach ( $wgCanonicalNamespaceNames as $i => $text ) {
foreach ( $wgContLang->getNamespaces() as $i => $text ) {
if (preg_match("/$ns/i", $text)) {
return $i;
}
}
return false; // if $ns not found above, does not exist
}