MediaWiki REL1_41
dumpMessages.php
Go to the documentation of this file.
1<?php
26require_once __DIR__ . '/../Maintenance.php';
27
34
35 public function __construct() {
36 parent::__construct();
37 $this->addDescription( 'Dump an entire language, using the keys from English' );
38 }
39
40 public function execute() {
41 $messages = [];
42 $localisationCache = $this->getServiceContainer()->getLocalisationCache();
43 $localisationMessagesEn = $localisationCache->getItem( 'en', 'messages' );
44 foreach ( $localisationMessagesEn as $key => $_ ) {
45 $messages[$key] = wfMessage( $key )->text();
46 }
47 $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
48 $this->output( serialize( $messages ) );
49 }
50}
51
52$maintClass = DumpMessages::class;
53require_once RUN_MAINTENANCE_IF_MAIN;
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:36
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