MediaWiki REL1_35
dumpMessages.php
Go to the documentation of this file.
1<?php
27
28require_once __DIR__ . '/../Maintenance.php';
29
36
39
40 public function __construct() {
41 parent::__construct();
42 $this->addDescription( 'Dump an entire language, using the keys from English' );
43 $this->localisationCache = MediaWikiServices::getInstance()->getLocalisationCache();
44 }
45
46 public function execute() {
47 $messages = [];
48 $localisationMessagesEn = $this->localisationCache->getItem( 'en', 'messages' );
49 foreach ( array_keys( $localisationMessagesEn ) as $key ) {
50 $messages[$key] = wfMessage( $key )->text();
51 }
52 $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
53 $this->output( serialize( $messages ) );
54 }
55}
56
57$maintClass = DumpMessages::class;
58require_once RUN_MAINTENANCE_IF_MAIN;
serialize()
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:40
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
const RUN_MAINTENANCE_IF_MAIN
Maintenance script that dumps an entire language, using the keys from English.
__construct()
Default constructor.
LocalisationCache $localisationCache
execute()
Do the actual work.
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
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.
MediaWikiServices is the service locator for the application scope of MediaWiki.
$maintClass