summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/ffs/JsonFFS.php')
-rw-r--r--MLEB/Translate/ffs/JsonFFS.php26
1 files changed, 9 insertions, 17 deletions
diff --git a/MLEB/Translate/ffs/JsonFFS.php b/MLEB/Translate/ffs/JsonFFS.php
index 58642bef..70ea86ac 100644
--- a/MLEB/Translate/ffs/JsonFFS.php
+++ b/MLEB/Translate/ffs/JsonFFS.php
@@ -16,6 +16,9 @@
* @since 2012-09-21
*/
class JsonFFS extends SimpleFFS {
+ /** @var ArrayFlattener */
+ private $flattener;
+
/**
* @param string $data
* @return bool
@@ -60,7 +63,7 @@ class JsonFFS extends SimpleFFS {
$messages = $this->flattener->flatten( $messages );
}
- $messages = $this->group->getMangler()->mangle( $messages );
+ $messages = $this->group->getMangler()->mangleArray( $messages );
return [
'MESSAGES' => $messages,
@@ -77,26 +80,16 @@ class JsonFFS extends SimpleFFS {
$messages = [];
$template = $this->read( $collection->getLanguage() );
- $messages['@metadata'] = [];
- if ( isset( $template['METADATA'] ) ) {
- $messages['@metadata'] = $template['METADATA'];
- }
+ $messages['@metadata'] = $template['METADATA'] ?? [];
$authors = $collection->getAuthors();
- $authors = $this->filterAuthors( $authors, $collection->code );
-
- if ( isset( $template['AUTHORS'] ) ) {
- $authors = array_unique( array_merge( $template['AUTHORS'], $authors ) );
- }
-
- if ( $authors !== [] ) {
- $messages['@metadata']['authors'] = array_values( $authors );
- }
+ $authors = $this->filterAuthors( $authors, $collection->getLanguage() );
+ $messages['@metadata']['authors'] = array_values( $authors );
$mangler = $this->group->getMangler();
/**
- * @var $m ThinMessage
+ * @var $m TMessage
*/
foreach ( $collection as $key => $m ) {
$value = $m->translation();
@@ -133,8 +126,7 @@ class JsonFFS extends SimpleFFS {
return null;
}
- $parseCLDRPlurals = isset( $this->extra['parseCLDRPlurals'] ) ?
- $this->extra['parseCLDRPlurals'] : false;
+ $parseCLDRPlurals = $this->extra['parseCLDRPlurals'] ?? false;
$flattener = new ArrayFlattener( $this->extra['nestingSeparator'], $parseCLDRPlurals );
return $flattener;