MediaWiki master
dumpMessages.php
Go to the documentation of this file.
1<?php
13
14// @codeCoverageIgnoreStart
15require_once __DIR__ . '/../Maintenance.php';
16// @codeCoverageIgnoreEnd
17
24
25 public function __construct() {
26 parent::__construct();
27 $this->addDescription( 'Dump an entire language, using the keys from English' );
28 }
29
30 public function execute() {
31 $messages = [];
32 $localisationCache = $this->getServiceContainer()->getLocalisationCache();
33 $localisationMessagesEn = $localisationCache->getItem( 'en', 'messages' );
34 foreach ( $localisationMessagesEn as $key => $_ ) {
35 $messages[$key] = wfMessage( $key )->text();
36 }
37 $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
38 $this->output( serialize( $messages ) );
39 }
40}
41
42// @codeCoverageIgnoreStart
43$maintClass = DumpMessages::class;
44require_once RUN_MAINTENANCE_IF_MAIN;
45// @codeCoverageIgnoreEnd
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:23
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