Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / maintenance / language / dumpMessages.php
blob37c87a8a1fd4f23fb2cb8992cdf001c275170267
1 <?php
2 /**
3 * Dump an entire language, using the keys from English
4 * so we get all the values, not just the customized ones
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
21 * @file
22 * @ingroup MaintenanceLanguage
23 * @todo Make this more useful, right now just dumps $wgContLang
26 require_once __DIR__ . '/../Maintenance.php';
28 /**
29 * Maintenance script that dumps an entire language, using the keys from English.
31 * @ingroup MaintenanceLanguage
33 class DumpMessages extends Maintenance {
34 public function __construct() {
35 parent::__construct();
36 $this->addDescription( 'Dump an entire language, using the keys from English' );
39 public function execute() {
40 global $wgVersion;
42 $messages = [];
43 foreach ( array_keys( Language::getMessagesFor( 'en' ) ) as $key ) {
44 $messages[$key] = wfMessage( $key )->text();
46 $this->output( "MediaWiki $wgVersion language file\n" );
47 $this->output( serialize( $messages ) );
51 $maintClass = "DumpMessages";
52 require_once RUN_MAINTENANCE_IF_MAIN;