MediaWiki  master
dumpMessages.php
Go to the documentation of this file.
1 <?php
26 require_once __DIR__ . '/../Maintenance.php';
27 
33 class DumpMessages extends Maintenance {
34  public function __construct() {
35  parent::__construct();
36  $this->addDescription( 'Dump an entire language, using the keys from English' );
37  }
38 
39  public function execute() {
40  global $wgVersion;
41 
42  $messages = [];
43  foreach ( array_keys( Language::getMessagesFor( 'en' ) ) as $key ) {
44  $messages[$key] = wfMessage( $key )->text();
45  }
46  $this->output( "MediaWiki $wgVersion language file\n" );
47  $this->output( serialize( $messages ) );
48  }
49 }
50 
51 $maintClass = DumpMessages::class;
52 require_once RUN_MAINTENANCE_IF_MAIN;
const RUN_MAINTENANCE_IF_MAIN
Definition: Maintenance.php:39
$wgVersion
MediaWiki version number.
serialize()
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: Maintenance.php:82
$maintClass
static getMessagesFor( $code)
Get all messages for a given language WARNING: this may take a long time.
Definition: Language.php:4576
addDescription( $text)
Set the description text.
output( $out, $channel=null)
Throw some output to the user.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Maintenance script that dumps an entire language, using the keys from English.