MediaWiki REL1_31
PageLangLogFormatter.php
Go to the documentation of this file.
1<?php
32 protected function getMessageParameters() {
33 // Get the user language for displaying language names
34 $userLang = $this->context->getLanguage()->getCode();
35 $params = parent::getMessageParameters();
36
37 // Get the language codes from log
38 $oldLang = $params[3];
39 $kOld = strrpos( $oldLang, '[' );
40 if ( $kOld ) {
41 $oldLang = substr( $oldLang, 0, $kOld );
42 }
43
44 $newLang = $params[4];
45 $kNew = strrpos( $newLang, '[' );
46 if ( $kNew ) {
47 $newLang = substr( $newLang, 0, $kNew );
48 }
49
50 // Convert language codes to names in user language
51 $logOld = Language::fetchLanguageName( $oldLang, $userLang )
52 . ' (' . $oldLang . ')';
53 $logNew = Language::fetchLanguageName( $newLang, $userLang )
54 . ' (' . $newLang . ')';
55
56 // Add the default message to languages if required
57 $params[3] = !$kOld ? $logOld : $logOld . ' [' . $this->msg( 'default' ) . ']';
58 $params[4] = !$kNew ? $logNew : $logNew . ' [' . $this->msg( 'default' ) . ']';
59 return $params;
60 }
61}
Implements the default log formatting.
msg( $key)
Shortcut for wfMessage which honors local context.
This class formats language change log entries.
getMessageParameters()
Formats parameters intented for action message from array of all parameters.
$params