MediaWiki REL1_39
dumpMessages.php
Go to the documentation of this file.
1<?php
27
28require_once __DIR__ . '/../Maintenance.php';
29
36
37 public function __construct() {
38 parent::__construct();
39 $this->addDescription( 'Dump an entire language, using the keys from English' );
40 }
41
42 public function execute() {
43 $messages = [];
44 $localisationCache = MediaWikiServices::getInstance()->getLocalisationCache();
45 $localisationMessagesEn = $localisationCache->getItem( 'en', 'messages' );
46 foreach ( array_keys( $localisationMessagesEn ) as $key ) {
47 $messages[$key] = wfMessage( $key )->text();
48 }
49 $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
50 $this->output( serialize( $messages ) );
51 }
52}
53
54$maintClass = DumpMessages::class;
55require_once RUN_MAINTENANCE_IF_MAIN;
serialize()
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.
addDescription( $text)
Set the description text.
Service locator for MediaWiki core services.
$maintClass