Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat Class Reference

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

Inheritance diagram for MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat:
MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport

Public Member Functions

 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 readFromVariable (string $data)
 @inheritDoc
 
 readRow (string $line)
 Parses non-empty strings file row to key and value.
 
 writeRow (string $key, string $value)
 Writes well-formed properties file row with key and value.
 
- Public Member Functions inherited from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat
 __construct (FileBasedMessageGroup $group)
 
 setGroup (FileBasedMessageGroup $group)
 
 getGroup ()
 
 setWritePath (string $target)
 Set the file's location in the system.
 
 getWritePath ()
 Get the file's location in the system.
 
 exists ( $code=false)
 Returns true if the file for this message group in a given language exists.
 
 read (string $languageCode)
 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 SimpleFormat formatted string.
 
 filterAuthors (array $authors, string $code)
 Remove excluded authors.
 
 isContentEqual (?string $a, ?string $b)
 Checks whether two strings are equal.
 
 shouldOverwrite (string $a, string $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 getExtraSchema ()
 

Protected Member Functions

 writeReal (MessageCollection $collection)
 
- Protected Member Functions inherited from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat
 tryReadSource (string $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 (string $filename)
 Read the contents of $filename and return it as a string.
 

Static Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat
FileBasedMessageGroup $group
 
string $writePath = null
 
 $extra
 

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

Definition at line 20 of file AppleFormat.php.

Member Function Documentation

◆ getExtraSchema()

static MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::getExtraSchema ( )
static

Definition at line 188 of file AppleFormat.php.

◆ getFileExtensions()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]

Reimplemented from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

Definition at line 25 of file AppleFormat.php.

◆ quoteString()

static MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::quoteString ( string $str)
staticprotected

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

Definition at line 140 of file AppleFormat.php.

◆ readFromVariable()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::readFromVariable ( string $data)

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

Definition at line 30 of file AppleFormat.php.

◆ readRow()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::readRow ( string $line)

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

Can be overridden by child classes.

Exceptions
InvalidArgumentException
Returns
array array( string $key, string $val )

Definition at line 82 of file AppleFormat.php.

◆ supportsFuzzy()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::supportsFuzzy ( )

Query the capabilities of this FFS.

Allowed values are:

  • yes
  • write (ignored on read)
  • no (stripped on write)

Reimplemented from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

Definition at line 21 of file AppleFormat.php.

◆ unescapeString()

static MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::unescapeString ( string $str)
staticprotected

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

Todo
support \UXXXX

Definition at line 156 of file AppleFormat.php.

◆ writeReal()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::writeReal ( MessageCollection $collection)
protected

Reimplemented from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat.

Definition at line 96 of file AppleFormat.php.

◆ writeRow()

MediaWiki\Extension\Translate\FileFormatSupport\AppleFormat::writeRow ( string $key,
string $value )

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

Can be overridden by child classes.

Definition at line 135 of file AppleFormat.php.


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