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

JavaFFS class implements support for Java properties files. More...

Inheritance diagram for JavaFFS:
SimpleFFS MetaYamlSchemaExtender FFS

Public Member Functions

 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 __construct (FileBasedMessageGroup $group)
 
 readFromVariable ( $data)
 
- Public Member Functions inherited from SimpleFFS
 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.
 
 isContentEqual ( $a, $b)
 Checks whether two strings are equal.
 
 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 writeRow ( $key, $sep, $value)
 Writes well-formed properties file row with key and value.
 
static readRow ( $line, $sep)
 Parses non-empty properties file row to key and value.
 
static getExtraSchema ()
 Return a data structure that will be merged with the base schema.
 
- Static Public Member Functions inherited from SimpleFFS
static fixNewLines ( $data)
 Replaces all Windows and Mac line endings with Unix line endings.
 

Public Attributes

 $messages = $this->group->getMangler()->mangleArray( $messages )
 
 return ['AUTHORS'=> $authors, 'MESSAGES'=> $messages,]
 

Protected Member Functions

 writeReal (MessageCollection $collection)
 
 doHeader (MessageCollection $collection)
 
 doAuthors (MessageCollection $collection)
 
- 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.
 

Protected Attributes

 $keySeparator = '='
 
- 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

JavaFFS class implements support for Java properties files.

This class reads and writes only utf-8 files. Java projects need to run native2ascii on them before using them.

This class adds a new item into FILES section of group configuration: keySeparator which defaults to '='.

Definition at line 12 of file JavaFFS.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from SimpleFFS.

Definition at line 24 of file JavaFFS.php.

Member Function Documentation

◆ doAuthors()

JavaFFS::doAuthors ( MessageCollection $collection)
protected
Parameters
MessageCollection$collection
Returns
string

Definition at line 235 of file JavaFFS.php.

◆ doHeader()

JavaFFS::doHeader ( MessageCollection $collection)
protected
Parameters
MessageCollection$collection
Returns
string

Definition at line 214 of file JavaFFS.php.

◆ getExtraSchema()

static JavaFFS::getExtraSchema ( )
static

Return a data structure that will be merged with the base schema.

It is not possible to remove things.

Returns
array

Implements MetaYamlSchemaExtender.

Definition at line 247 of file JavaFFS.php.

◆ getFileExtensions()

JavaFFS::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]
Since
2013-04

Reimplemented from SimpleFFS.

Definition at line 17 of file JavaFFS.php.

◆ readFromVariable()

JavaFFS::readFromVariable ( $data)
Parameters
string$data
Returns
array Parsed data.
Exceptions
MWException

Reimplemented from SimpleFFS.

Definition at line 37 of file JavaFFS.php.

◆ readRow()

static JavaFFS::readRow ( $line,
$sep )
static

Parses non-empty properties file row to key and value.

Parameters
string$line
string$sep
Returns
string[]
Since
2012-03-28

Definition at line 157 of file JavaFFS.php.

◆ supportsFuzzy()

JavaFFS::supportsFuzzy ( )

Query the capabilities of this FFS.

Allowed values are:

  • yes
  • write (ignored on read)
  • no (stripped on write)
    Returns
    string
    Since
    2013-03-05

Reimplemented from SimpleFFS.

Definition at line 13 of file JavaFFS.php.

◆ writeReal()

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

Reimplemented from SimpleFFS.

Definition at line 98 of file JavaFFS.php.

◆ writeRow()

static JavaFFS::writeRow ( $key,
$sep,
$value )
static

Writes well-formed properties file row with key and value.

Parameters
string$key
string$sep
string$value
Returns
string
Since
2012-03-28

Definition at line 139 of file JavaFFS.php.

Member Data Documentation

◆ $keySeparator

JavaFFS::$keySeparator = '='
protected

Definition at line 21 of file JavaFFS.php.

◆ $messages

JavaFFS::$messages = $this->group->getMangler()->mangleArray( $messages )

Definition at line 86 of file JavaFFS.php.

◆ return

JavaFFS::return[ 'AUTHORS'=> $authors, 'MESSAGES'=> $messages,]

Definition at line 88 of file JavaFFS.php.


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