MediaWiki master
LanguageConverterSpecific.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Language;
8
10
27 public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
28 // check for user namespace
29 if ( is_object( $nt ) ) {
30 $ns = $nt->getNamespace();
31 if ( $ns === NS_USER || $ns === NS_USER_TALK ) {
32 return;
33 }
34 }
35
36 $oldlink = $link;
37 parent::findVariantLink( $link, $nt, $ignoreOtherCond );
38 if ( $this->getPreferredVariant() == $this->getMainCode() ) {
39 $link = $oldlink;
40 }
41 }
42}
43
45class_alias( LanguageConverterSpecific::class, 'LanguageConverterSpecific' );
const NS_USER
Definition Defines.php:53
const NS_USER_TALK
Definition Defines.php:54
A class that extends LanguageConverter with specific behaviour.
findVariantLink(&$link, &$nt, $ignoreOtherCond=false)
A function wrapper:
Base class for multi-variant language conversion.
getMainCode()
Get the language code with converter (the "main" language code).
getPreferredVariant()
Get preferred language variant.string The preferred language code
Represents a title within MediaWiki.
Definition Title.php:69