Index: trunk/extensions/Wikidata/App.php |
— | — | @@ -252,7 +252,25 @@ |
253 | 253 | } |
254 | 254 | |
255 | 255 | function efWikidataOverrideArticle( &$title, &$article ) { |
256 | | - if ( wdIsWikidataNs() ) $article = new WikidataArticle( $title ); |
| 256 | + global $wgLang, $wgRequest, $wgOut ; |
| 257 | + if ( wdIsWikidataNs() ) { |
| 258 | + $article = new WikidataArticle( $title ); |
| 259 | + return true ; |
| 260 | + } |
| 261 | + |
| 262 | + if ($wgRequest->getVal( 'redirect' ) == 'no') { |
| 263 | + return true; |
| 264 | + } |
| 265 | + |
| 266 | + // finds if there is a translation of the page in the user language |
| 267 | + $lang = $wgLang->getCode(); |
| 268 | + $n = $title->getDBkey(); |
| 269 | + $ns = $title->getNamespace(); |
| 270 | + $t = Title::makeTitle( $ns, $n . '/' . $lang ); |
| 271 | + |
| 272 | + if ( $t->exists() ) { |
| 273 | + $title = $t ; |
| 274 | + } |
257 | 275 | return true; |
258 | 276 | } |
259 | 277 | |