MediaWiki
REL1_34
JSONReader.php
Go to the documentation of this file.
1
<?php
8
namespace
LocalisationUpdate
;
9
13
class
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
}
LocalisationUpdate\JSONReader
Reads MediaWiki JSON i18n files.
Definition
JSONReader.php:13
LocalisationUpdate\JSONReader\__construct
__construct( $code=null)
Definition
JSONReader.php:17
LocalisationUpdate\JSONReader\$code
$code
Definition
JSONReader.php:15
LocalisationUpdate\JSONReader\parse
parse( $contents)
Definition
JSONReader.php:26
LocalisationUpdate\Reader
Interface for file readers.
Definition
Reader.php:13
LocalisationUpdate
Definition
Fetcher.php:8
extensions
LocalisationUpdate
includes
reader
JSONReader.php
Generated on Mon Nov 25 2024 16:04:38 for MediaWiki by
1.10.0