Public Member Functions | |
supportsFuzzy () | |
Query the capabilities of this FFS. | |
getFileExtensions () | |
Return the commonly used file extensions for these formats. | |
__construct (FileBasedMessageGroup $group) | |
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. | |
readFromVariable ( $data) | |
Parse the message data given as a string in the SimpleFFS format and return it as an array of AUTHORS and MESSAGES. | |
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 | fixNewLines ( $data) |
Replaces all Windows and Mac line endings with Unix line endings. | |
Protected Member Functions | |
writeReal (MessageCollection $collection) | |
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 | |
$group | |
$writePath | |
$extra | |
Stores the FILES section of the YAML configuration, which can be accessed for extra FFS class specific options. | |
Definition at line 19 of file SimpleFFS.php.
SimpleFFS::__construct | ( | FileBasedMessageGroup | $group | ) |
SimpleFFS::exists | ( | $code = false | ) |
Returns true if the file for this message group in a given language exists.
If no $code is given, the groups source language is assumed. NB: Some formats store all languages in the same file, and then this function will return true even if there are no translations to that language.
string | bool | $code |
Definition at line 76 of file SimpleFFS.php.
SimpleFFS::filterAuthors | ( | array | $authors, |
$code ) |
Remove excluded authors.
array | $authors | |
string | $code |
Definition at line 325 of file SimpleFFS.php.
|
static |
Replaces all Windows and Mac line endings with Unix line endings.
This is needed in some file types.
string | $data |
Definition at line 345 of file SimpleFFS.php.
SimpleFFS::getFileExtensions | ( | ) |
Return the commonly used file extensions for these formats.
Include the dot.
Implements FFS.
Reimplemented in AmdFFS, AndroidXmlFFS, AppleFFS, DtdFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, XliffFFS, and YamlFFS.
Definition at line 24 of file SimpleFFS.php.
SimpleFFS::getGroup | ( | ) |
Definition at line 52 of file SimpleFFS.php.
SimpleFFS::getWritePath | ( | ) |
SimpleFFS::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.
string | $a | |
string | $b |
Implements FFS.
Reimplemented in AndroidXmlFFS, GettextFFS, JsonFFS, and YamlFFS.
Definition at line 352 of file SimpleFFS.php.
SimpleFFS::isGroupFfsReadable | ( | ) |
Check if the file format of the current group is readable by the file format system.
This might happen if we are trying to export a JsonFFS or WikiPageMessage group to a GettextFFS
Definition at line 366 of file SimpleFFS.php.
SimpleFFS::read | ( | $code | ) |
Reads messages from the file in a given language and returns an array of AUTHORS, MESSAGES and possibly other properties.
string | $code | Language code. |
MWException | if the file is not readable or has bad encoding |
Implements FFS.
Reimplemented in GettextFFS, and XliffFFS.
Definition at line 97 of file SimpleFFS.php.
SimpleFFS::readFromVariable | ( | $data | ) |
Parse the message data given as a string in the SimpleFFS format and return it as an array of AUTHORS and MESSAGES.
string | $data |
MWException |
Implements FFS.
Reimplemented in AmdFFS, AndroidXmlFFS, AppleFFS, DtdFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, and YamlFFS.
Definition at line 136 of file SimpleFFS.php.
SimpleFFS::setGroup | ( | FileBasedMessageGroup | $group | ) |
FileBasedMessageGroup | $group |
Definition at line 47 of file SimpleFFS.php.
SimpleFFS::setWritePath | ( | $writePath | ) |
SimpleFFS::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.
string | $a | The existing content. |
string | $b | The new export content. |
Implements FFS.
Reimplemented in GettextFFS.
Definition at line 356 of file SimpleFFS.php.
SimpleFFS::supportsFuzzy | ( | ) |
Query the capabilities of this FFS.
Allowed values are:
Implements FFS.
Reimplemented in AndroidXmlFFS, AppleFFS, GettextFFS, IniFFS, JavaFFS, and XliffFFS.
Definition at line 20 of file SimpleFFS.php.
|
protected |
Read the contents of $filename and return it as a string.
Return false if the file doesn't exist. Throw an exception if the file isn't readable or if the reading fails strangely.
string | $filename |
MWException |
Definition at line 297 of file SimpleFFS.php.
|
protected |
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.
string | $filename | |
MessageCollection | $collection |
Definition at line 269 of file SimpleFFS.php.
SimpleFFS::write | ( | MessageCollection | $collection | ) |
Write the collection to file.
MessageCollection | $collection |
MWException |
Implements FFS.
Definition at line 177 of file SimpleFFS.php.
SimpleFFS::writeIntoVariable | ( | MessageCollection | $collection | ) |
Read a collection and return it as a SimpleFFS formatted string.
MessageCollection | $collection |
Implements FFS.
Definition at line 228 of file SimpleFFS.php.
|
protected |
MessageCollection | $collection |
Reimplemented in AmdFFS, AndroidXmlFFS, AppleFFS, DtdFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, XliffFFS, and YamlFFS.
Definition at line 239 of file SimpleFFS.php.
|
protected |
Stores the FILES section of the YAML configuration, which can be accessed for extra FFS class specific options.
Definition at line 35 of file SimpleFFS.php.
|
protected |
Definition at line 29 of file SimpleFFS.php.
|
protected |
Definition at line 30 of file SimpleFFS.php.