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

AppleFFS class implements support for Apple .strings files. More...

Inheritance diagram for AppleFFS:
SimpleFFS FFS AppleInfoPlistFfs

Public Member Functions

 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 readFromVariable ( $data)
 
- Public Member Functions inherited from SimpleFFS
 __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.
 
 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 readRow ( $line)
 Parses non-empty strings file row to key and value.
 
static writeRow ( $key, $value)
 Writes well-formed properties file row with key and value.
 
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)
 
 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.
 

Static Protected Member Functions

static quoteString ( $str)
 Quote and escape Obj-C-style strings for .strings format.
 
static escapeString ( $str)
 Escape Obj-C-style strings; use backslash-escapes etc.
 
static unescapeString ( $str)
 Unescape Obj-C-style strings; can include backslash-escapes.
 

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

AppleFFS class implements support for Apple .strings files.

This class reads and writes only UTF-8 files.

This class has not yet been battle-tested, so beware.

Author
Brion Vibber bvibb.nosp@m.er@w.nosp@m.ikime.nosp@m.dia..nosp@m.org
Since
2014.02

Definition at line 14 of file AppleFFS.php.

Member Function Documentation

◆ doAuthors()

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

Definition at line 205 of file AppleFFS.php.

◆ doHeader()

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

Definition at line 184 of file AppleFFS.php.

◆ escapeString()

static AppleFFS::escapeString ( $str)
staticprotected

Escape Obj-C-style strings; use backslash-escapes etc.

Parameters
string$str
Returns
string

Definition at line 162 of file AppleFFS.php.

◆ getExtraSchema()

static AppleFFS::getExtraSchema ( )
static

Definition at line 217 of file AppleFFS.php.

◆ getFileExtensions()

AppleFFS::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]
Since
2013-04

Reimplemented from SimpleFFS.

Definition at line 19 of file AppleFFS.php.

◆ quoteString()

static AppleFFS::quoteString ( $str)
staticprotected

Quote and escape Obj-C-style strings for .strings format.

Parameters
string$str
Returns
string

Definition at line 152 of file AppleFFS.php.

◆ readFromVariable()

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

Reimplemented from SimpleFFS.

Definition at line 28 of file AppleFFS.php.

◆ readRow()

static AppleFFS::readRow ( $line)
static

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

Can be overridden by child classes.

Parameters
string$line
Exceptions
MWException
Returns
array array( string $key, string $val )

Reimplemented in AppleInfoPlistFfs.

Definition at line 82 of file AppleFFS.php.

◆ supportsFuzzy()

AppleFFS::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 15 of file AppleFFS.php.

◆ unescapeString()

static AppleFFS::unescapeString ( $str)
staticprotected

Unescape Obj-C-style strings; can include backslash-escapes.

Todo
support \UXXXX
Parameters
string$str
Returns
string

Definition at line 176 of file AppleFFS.php.

◆ writeReal()

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

Reimplemented from SimpleFFS.

Definition at line 100 of file AppleFFS.php.

◆ writeRow()

static AppleFFS::writeRow ( $key,
$value )
static

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

Can be overridden by child classes.

Parameters
string$key
string$value
Returns
string

Reimplemented in AppleInfoPlistFfs.

Definition at line 142 of file AppleFFS.php.


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