MediaWiki REL1_30
JSONReader.php
Go to the documentation of this file.
1<?php
8namespace LocalisationUpdate;
9
13class JSONReader implements Reader {
15 protected $code;
16
17 public function __construct( $code = null ) {
18 $this->code = $code;
19 }
20
21 public function parse( $contents ) {
22 $messages = \FormatJson::decode( $contents, true );
23 unset( $messages['@metadata'] );
24
25 if ( $this->code ) {
26 return [ $this->code => $messages ];
27 }
28
29 // Assuming that the array is keyed by language codes
30 return $messages;
31 }
32}
$messages
Reads MediaWiki JSON i18n files.
parse( $contents)
Returns a list of messages indexed by language code.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition hooks.txt:863
Interface for file readers.
Definition Reader.php:13