MediaWiki REL1_34
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
26 public function parse( $contents ) {
27 $messages = \FormatJson::decode( $contents, true );
28 unset( $messages['@metadata'] );
29
30 if ( $this->code ) {
31 return [ $this->code => $messages ];
32 }
33
34 // Assuming that the array is keyed by language codes
35 return $messages;
36 }
37}
Reads MediaWiki JSON i18n files.
Interface for file readers.
Definition Reader.php:13