69 private $localisationCache;
93 parent::__construct( $context, $linkRenderer );
94 $this->localisationCache = $localisationCache;
96 $this->mIndexField =
'am_title';
105 $this->langcode = $this->lang->
getCode();
106 $this->foreign = !$this->lang->equals( $contentLanguage );
108 $filter = $opts->
getValue(
'filter' );
109 if ( $filter ===
'all' ) {
110 $this->custom =
null;
112 $this->custom = ( $filter ===
'unmodified' );
121 $displayPrefix =
$prefix->getDBkey();
122 $this->prefix =
'/^' . preg_quote( $displayPrefix,
'/' ) .
'/i';
124 $this->prefix =
false;
129 if ( $this->foreign ) {
136 private function getAllMessages( $descending ) {
137 $messageNames = $this->localisationCache->getSubitemList(
'en',
'messages' );
140 $messageNames = array_map( [ $this->lang,
'ucfirst' ], $messageNames );
143 rsort( $messageNames );
145 asort( $messageNames );
148 return $messageNames;
175 [
'page_namespace',
'page_title' ],
178 [
'USE INDEX' =>
'page_name_title' ]
180 $xNames = array_fill_keys( $messageNames,
true );
182 $pageFlags = $talkFlags = [];
188 $titleParts = explode(
'/',
$s->page_title );
189 if ( count( $titleParts ) === 2 &&
191 isset( $xNames[$titleParts[0]] )
193 $exists = $titleParts[0];
195 } elseif ( isset( $xNames[
$s->page_title] ) ) {
196 $exists =
$s->page_title;
201 $pageFlags[$exists] =
true;
203 $talkFlags[$exists] =
true;
207 return [
'pages' => $pageFlags,
'talks' => $talkFlags ];
221 $messageNames = $this->getAllMessages( $order );
231 foreach ( $messageNames as $key ) {
232 $customised = isset( $statuses[
'pages'][$key] );
233 if ( $customised !== $this->custom &&
234 ( $asc && ( $key < $offset || !$offset ) || !$asc && $key > $offset ) &&
235 ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix ===
false )
237 $actual = $this->
msg( $key )->inLanguage( $this->lang )->plain();
238 $default = $this->
msg( $key )->inLanguage( $this->lang )->useDatabase(
false )->plain();
241 'am_actual' => $actual,
242 'am_default' => $default,
243 'am_customised' => $customised,
244 'am_talk_exists' => isset( $statuses[
'talks'][$key] )
249 if ( $count === $limit ) {
258 return Xml::openElement(
'table', [
260 'id' =>
'mw-allmessagestable'
264 <th rowspan=\"2\">" .
265 $this->
msg(
'allmessagesname' )->escaped() .
"
268 $this->
msg(
'allmessagesdefault' )->escaped() .
273 $this->
msg(
'allmessagescurrent' )->escaped() .
279 return Html::closeElement(
'table' );
295 'title' =>
'Special:SearchTranslations',
296 'group' =>
'mediawiki',
297 'grouppath' =>
'mediawiki',
299 'query' => $value .
' ' . $this->
msg( $value )->plain()
301 $this->
msg(
'allmessages-filter-translate' )->text()
303 $talkLink = $this->
msg(
'talkpagelinktext' )->text();
305 if ( $this->mCurrentRow->am_customised ) {
308 $title = $linkRenderer->makeBrokenLink(
312 if ( $this->mCurrentRow->am_talk_exists ) {
313 $talk = $linkRenderer->makeKnownLink( $talk, $talkLink );
315 $talk = $linkRenderer->makeBrokenLink(
322 $this->
msg(
'parentheses' )->rawParams( $talk )->escaped() .
324 $this->
msg(
'parentheses' )->rawParams( $translation )->escaped();
328 return Sanitizer::escapeHtmlAllowEntities( $value );
340 $s = parent::formatRow( $row );
343 if ( $row->am_customised ) {
345 $formatted = strval( $this->
formatValue(
'am_actual', $row->am_actual ) );
347 if ( $formatted ===
'' ) {
348 $formatted =
"\u{00A0}";
351 $s .= Html::rawElement(
'td', $this->
getCellAttrs(
'am_actual', $row->am_actual ), $formatted )
352 . Html::closeElement(
'tr' );
355 return Html::rawElement(
'tbody', [],
$s );
369 if ( $field ===
'am_title' ) {
370 if ( $this->mCurrentRow->am_customised ) {
371 $attr += [
'rowspan' =>
'2' ];
375 'lang' => $this->lang->getHtmlCode(),
376 'dir' => $this->lang->getDir(),
378 if ( $this->mCurrentRow->am_customised ) {
380 $attr += [
'class' => $field ];
389 'am_title' => $this->
msg(
'allmessagesname' )->text(),
390 'am_default' => $this->
msg(
'allmessagesdefault' )->text()
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Base class for language-specific code.
getCode()
Get the internal language code for this language object.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
Caching for the contents of localisation files.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Interface for objects which can provide a MediaWiki context on request.
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s