Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
FFS Interface Reference

Interface for file system support classes. More...

Inheritance diagram for FFS:
SimpleFFS AmdFFS AndroidXmlFFS AppleFFS DtdFFS GettextFFS IniFFS JavaFFS JavaScriptFFS JsonFFS XliffFFS YamlFFS

Public Member Functions

 __construct (FileBasedMessageGroup $group)
 
 setWritePath ( $target)
 Set the file's location in the system.
 
 getWritePath ()
 Get the file's location in the system.
 
 read ( $code)
 Will parse messages, authors, and any custom data from the file and return it in associative array with keys like AUTHORS and MESSAGES.
 
 readFromVariable ( $data)
 Same as read(), but takes the data as a parameter.
 
 write (MessageCollection $collection)
 Writes to the location provided with setWritePath and group specific directory structure.
 
 writeIntoVariable (MessageCollection $collection)
 Quick shortcut for getting the plain exported data.
 
 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 isContentEqual ( $a, $b)
 Checks whether two strings are equal.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 shouldOverwrite ( $a, $b)
 Allows to skip writing the export output into a file.
 

Detailed Description

Interface for file system support classes.

Definition at line 19 of file FFS.php.

Constructor & Destructor Documentation

◆ __construct()

FFS::__construct ( FileBasedMessageGroup $group)

Implemented in JavaFFS, JsonFFS, and YamlFFS.

Member Function Documentation

◆ getFileExtensions()

FFS::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]
Since
2013-04

Implemented in AmdFFS, AndroidXmlFFS, AppleFFS, DtdFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, SimpleFFS, XliffFFS, and YamlFFS.

◆ getWritePath()

FFS::getWritePath ( )

Get the file's location in the system.

Returns
string

Implemented in SimpleFFS.

◆ isContentEqual()

FFS::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

Implemented in AndroidXmlFFS, GettextFFS, JsonFFS, SimpleFFS, and YamlFFS.

◆ read()

FFS::read ( $code)

Will parse messages, authors, and any custom data from the file and return it in associative array with keys like AUTHORS and MESSAGES.

Parameters
string$codeLanguage code.
Returns
array|bool Parsed data or false on failure.

Implemented in GettextFFS, SimpleFFS, and XliffFFS.

◆ readFromVariable()

FFS::readFromVariable ( $data)

Same as read(), but takes the data as a parameter.

The caller is supposed to know in what language the translations are.

Parameters
string$dataFormatted messages.
Returns
array Parsed data.

Implemented in AmdFFS, AndroidXmlFFS, AppleFFS, DtdFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, SimpleFFS, and YamlFFS.

◆ setWritePath()

FFS::setWritePath ( $target)

Set the file's location in the system.

Parameters
string$targetFilesystem path for exported files.

Implemented in SimpleFFS.

◆ shouldOverwrite()

FFS::shouldOverwrite ( $a,
$b )

Allows to skip writing the export output into a file.

This is useful to skip updates that would only update irrelevant parts, such as the timestamp of the export.

Parameters
string$aThe existing content.
string$bThe new export content.
Returns
bool
Since
2017.04

Implemented in GettextFFS, and SimpleFFS.

◆ supportsFuzzy()

FFS::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

Implemented in AndroidXmlFFS, AppleFFS, GettextFFS, IniFFS, JavaFFS, SimpleFFS, and XliffFFS.

◆ write()

FFS::write ( MessageCollection $collection)

Writes to the location provided with setWritePath and group specific directory structure.

Exports translations included in the given collection with any special handling needed.

Parameters
MessageCollection$collection

Implemented in SimpleFFS.

◆ writeIntoVariable()

FFS::writeIntoVariable ( MessageCollection $collection)

Quick shortcut for getting the plain exported data.

Same as write(), but returns the output instead of writing it into a file.

Parameters
MessageCollection$collection
Returns
string

Implemented in SimpleFFS.


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