MediaWiki
REL1_35
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
38
private
$localisationCache
;
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;
58
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:40
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:1220
RUN_MAINTENANCE_IF_MAIN
const RUN_MAINTENANCE_IF_MAIN
Definition
Maintenance.php:38
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:40
DumpMessages\$localisationCache
LocalisationCache $localisationCache
Definition
dumpMessages.php:38
DumpMessages\execute
execute()
Do the actual work.
Definition
dumpMessages.php:46
LocalisationCache
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
Definition
LocalisationCache.php:43
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
Maintenance.php:55
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition
Maintenance.php:432
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:325
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition
MediaWikiServices.php:152
$maintClass
$maintClass
Definition
dumpMessages.php:57
maintenance
language
dumpMessages.php
Generated on Sat Apr 6 2024 00:08:26 for MediaWiki by
1.9.8