MediaWiki
REL1_37
dumpMessages.php
Go to the documentation of this file.
1
<?php
26
use
MediaWiki\MediaWikiServices
;
27
28
require_once __DIR__ .
'/../Maintenance.php'
;
29
35
class
DumpMessages
extends
Maintenance
{
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;
55
require_once RUN_MAINTENANCE_IF_MAIN;
serialize
serialize()
Definition
ApiMessageTrait.php:138
MW_VERSION
const MW_VERSION
The running version of MediaWiki.
Definition
Defines.php:36
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:1182
DumpMessages
Maintenance script that dumps an entire language, using the keys from English.
Definition
dumpMessages.php:35
DumpMessages\__construct
__construct()
Default constructor.
Definition
dumpMessages.php:37
DumpMessages\execute
execute()
Do the actual work.
Definition
dumpMessages.php:42
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
Maintenance.php:59
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition
Maintenance.php:435
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:329
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition
MediaWikiServices.php:190
$maintClass
$maintClass
Definition
dumpMessages.php:54
maintenance
language
dumpMessages.php
Generated on Fri Apr 5 2024 23:41:22 for MediaWiki by
1.9.8