Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
JsonFFS Class Reference

JsonFFS implements a message format where messages are encoded as key-value pairs in JSON objects. More...

Inheritance diagram for JsonFFS:
SimpleFFS FFS

Public Member Functions

 __construct (FileBasedMessageGroup $group)
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 readFromVariable ( $data)
 
 generateFile (array $template)
 
 isContentEqual ( $a, $b)
 Checks whether two strings are equal.
 
- Public Member Functions inherited from SimpleFFS
 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 setGroup (FileBasedMessageGroup $group)
 
 getGroup ()
 
 setWritePath ( $writePath)
 
 getWritePath ()
 
 exists ( $code=false)
 Returns true if the file for this message group in a given language exists.
 
 read ( $code)
 Reads messages from the file in a given language and returns an array of AUTHORS, MESSAGES and possibly other properties.
 
 write (MessageCollection $collection)
 Write the collection to file.
 
 writeIntoVariable (MessageCollection $collection)
 Read a collection and return it as a SimpleFFS formatted string.
 
 filterAuthors (array $authors, $code)
 Remove excluded authors.
 
 shouldOverwrite ( $a, $b)
 Allows to skip writing the export output into a file.
 
 isGroupFfsReadable ()
 Check if the file format of the current group is readable by the file format system.
 

Static Public Member Functions

static isValid ( $data)
 
static getExtraSchema ()
 
- Static Public Member Functions inherited from SimpleFFS
static fixNewLines ( $data)
 Replaces all Windows and Mac line endings with Unix line endings.
 

Protected Member Functions

 writeReal (MessageCollection $collection)
 
 getFlattener ()
 
- Protected Member Functions inherited from SimpleFFS
 tryReadSource ( $filename, MessageCollection $collection)
 This tries to pick up external authors in the source files so that they are not lost if those authors are not among those who have translated in the wiki.
 
 tryReadFile ( $filename)
 Read the contents of $filename and return it as a string.
 

Additional Inherited Members

- Protected Attributes inherited from SimpleFFS
 $group
 
 $writePath
 
 $extra
 Stores the FILES section of the YAML configuration, which can be accessed for extra FFS class specific options.
 

Detailed Description

JsonFFS implements a message format where messages are encoded as key-value pairs in JSON objects.

The format is extended to support author information under the special @metadata key.

Since
2012-09-21

Definition at line 20 of file JsonFFS.php.

Constructor & Destructor Documentation

◆ __construct()

JsonFFS::__construct ( FileBasedMessageGroup $group)
Parameters
FileBasedMessageGroup$group

Reimplemented from SimpleFFS.

Definition at line 33 of file JsonFFS.php.

Member Function Documentation

◆ generateFile()

JsonFFS::generateFile ( array $template)

Definition at line 109 of file JsonFFS.php.

◆ getExtraSchema()

static JsonFFS::getExtraSchema ( )
static

Definition at line 149 of file JsonFFS.php.

◆ getFileExtensions()

JsonFFS::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]
Since
2013-04

Reimplemented from SimpleFFS.

Definition at line 38 of file JsonFFS.php.

◆ getFlattener()

JsonFFS::getFlattener ( )
protected

Definition at line 130 of file JsonFFS.php.

◆ isContentEqual()

JsonFFS::isContentEqual ( $a,
$b )

Checks whether two strings are equal.

Sometimes same content might have multiple representations. The main case are inline plurals, which in some formats require expansion at export time.

Parameters
string$a
string$b
Returns
bool
Since
2016.11

Reimplemented from SimpleFFS.

Definition at line 141 of file JsonFFS.php.

◆ isValid()

static JsonFFS::isValid ( $data)
static
Parameters
string$data
Returns
bool

Definition at line 28 of file JsonFFS.php.

◆ readFromVariable()

JsonFFS::readFromVariable ( $data)
Parameters
string$data
Returns
array Parsed data.

Reimplemented from SimpleFFS.

Definition at line 46 of file JsonFFS.php.

◆ writeReal()

JsonFFS::writeReal ( MessageCollection $collection)
protected
Parameters
MessageCollection$collection
Returns
string

Reimplemented from SimpleFFS.

Definition at line 79 of file JsonFFS.php.


The documentation for this class was generated from the following file: