Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / maintenance / language / dumpMessages.php
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
5 *
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.
10 *
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.
15 *
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
20 *
21 * @file
22 * @ingroup MaintenanceLanguage
23 * @todo Make this more useful, right now just dumps $wgContLang
24 */
25
26 require_once __DIR__ . '/../Maintenance.php';
27
28 /**
29 * Maintenance script that dumps an entire language, using the keys from English.
30 *
31 * @ingroup MaintenanceLanguage
32 */
33 class DumpMessages extends Maintenance {
34 public function __construct() {
35 parent::__construct();
36 $this->addDescription( 'Dump an entire language, using the keys from English' );
37 }
38
39 public function execute() {
40 global $wgVersion;
41
42 $messages = [];
43 foreach ( array_keys( Language::getMessagesFor( 'en' ) ) as $key ) {
44 $messages[$key] = wfMessage( $key )->text();
45 }
46 $this->output( "MediaWiki $wgVersion language file\n" );
47 $this->output( serialize( $messages ) );
48 }
49 }
50
51 $maintClass = DumpMessages::class;
52 require_once RUN_MAINTENANCE_IF_MAIN;