MediaWiki master
dumpMessages.php
Go to the documentation of this file.
1<?php
27
28// @codeCoverageIgnoreStart
29require_once __DIR__ . '/../Maintenance.php';
30// @codeCoverageIgnoreEnd
31
38
39 public function __construct() {
40 parent::__construct();
41 $this->addDescription( 'Dump an entire language, using the keys from English' );
42 }
43
44 public function execute() {
45 $messages = [];
46 $localisationCache = $this->getServiceContainer()->getLocalisationCache();
47 $localisationMessagesEn = $localisationCache->getItem( 'en', 'messages' );
48 foreach ( $localisationMessagesEn as $key => $_ ) {
49 $messages[$key] = wfMessage( $key )->text();
50 }
51 $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
52 $this->output( serialize( $messages ) );
53 }
54}
55
56// @codeCoverageIgnoreStart
57$maintClass = DumpMessages::class;
58require_once RUN_MAINTENANCE_IF_MAIN;
59// @codeCoverageIgnoreEnd
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:37
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Maintenance script that dumps an entire language, using the keys from English.
__construct()
Default constructor.
execute()
Do the actual work.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
$maintClass