Topic on Extension talk:CopyWatchers

namespaces in non-english wikis

1
192.164.80.36 (talkcontribs)

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
  }
Reply to "namespaces in non-english wikis"