Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport Interface Reference
Inheritance diagram for MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport:
MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat MediaWiki\Extension\Translate\FileFormatSupport\AmdFormat MediaWiki\Extension\Translate\FileFormatSupport\AndroidXmlFormat MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat MediaWiki\Extension\Translate\FileFormatSupport\DtdFormat MediaWiki\Extension\Translate\FileFormatSupport\GettextFormat MediaWiki\Extension\Translate\FileFormatSupport\IniFormat MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat MediaWiki\Extension\Translate\FileFormatSupport\JsonFormat MediaWiki\Extension\Translate\FileFormatSupport\YamlFormat

Public Member Functions

 __construct (FileBasedMessageGroup $group)
 
 setWritePath (string $target)
 Set the file's location in the system.
 
 getWritePath ()
 Get the file's location in the system.
 
 read (string $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 (string $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 (?string $a, ?string $b)
 Checks whether two strings are equal.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 shouldOverwrite (string $a, string $b)
 Allows to skip writing the export output into a file.
 

Detailed Description

Definition at line 19 of file FileFormatSupport.php.

Member Function Documentation

◆ getFileExtensions()

◆ getWritePath()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::getWritePath ( )

Get the file's location in the system.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

◆ isContentEqual()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::isContentEqual ( ?string $a,
?string $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.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\AndroidXmlFormat, MediaWiki\Extension\Translate\FileFormatSupport\JsonFormat, MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat, and MediaWiki\Extension\Translate\FileFormatSupport\YamlFormat.

◆ read()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::read ( string $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 MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

◆ readFromVariable()

◆ setWritePath()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::setWritePath ( string $target)

Set the file's location in the system.

Parameters
string$targetFilesystem path for exported files.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

◆ shouldOverwrite()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::shouldOverwrite ( string $a,
string $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.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

◆ supportsFuzzy()

◆ write()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::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.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

◆ writeIntoVariable()

MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport::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.

Implemented in MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.


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