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

New-style FFS class that implements support for gettext file format. More...

Inheritance diagram for GettextFFS:
SimpleFFS MediaWiki\Extension\Translate\MessageGroupConfiguration\MetaYamlSchemaExtender FFS

Public Member Functions

 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 setOfflineMode ( $value)
 
 read ( $code)
 @inheritDoc
 
 readFromVariable ( $data)
 
 parseGettext ( $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.
 
 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 parseGettextData ( $data, $useCtxtAsKey, StringMangler $mangler, $keyAlgorithm, bool $allowPotMode)
 Parses gettext file as string into internal representation.
 
static parseGettextSection ( $section, $pluralCount)
 
static processGettextPluralMessage ( $pluralCount, $section)
 
static parseFlags ( $section)
 
static expectKeyword ( $name, $section)
 
static generateKeyFromItem (array $item, $algorithm='simple')
 Generates unique key for each message.
 
static formatForWiki ( $data, $whitespace='mark')
 This parses the Gettext text block format.
 
static parseHeaderTags ( $headers)
 
- Static Public Member Functions inherited from MediaWiki\Extension\Translate\MessageGroupConfiguration\MetaYamlSchemaExtender
static getExtraSchema ()
 Return a data structure that will be merged with the base schema.
 

Protected Member Functions

 writeReal (MessageCollection $collection)
 
 doGettextHeader (MessageCollection $collection, $template)
 
- 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.
 

Protected Attributes

 $offlineMode = false
 
- 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

New-style FFS class that implements support for gettext file format.

Definition at line 24 of file GettextFFS.php.

Member Function Documentation

◆ doGettextHeader()

GettextFFS::doGettextHeader ( MessageCollection $collection,
$template )
protected

Definition at line 422 of file GettextFFS.php.

◆ expectKeyword()

static GettextFFS::expectKeyword ( $name,
$section )
static

Definition at line 302 of file GettextFFS.php.

◆ formatForWiki()

static GettextFFS::formatForWiki ( $data,
$whitespace = 'mark' )
static

This parses the Gettext text block format.

Since trailing whitespace is not allowed in MediaWiki pages, the default action is to append -character at the end of the message. You can also choose to ignore it and use the trim action instead.

Parameters
string$data
string$whitespace
Exceptions
MWException
Returns
string

Definition at line 362 of file GettextFFS.php.

◆ generateKeyFromItem()

static GettextFFS::generateKeyFromItem ( array $item,
$algorithm = 'simple' )
static

Generates unique key for each message.

Changing this WILL BREAK ALL existing pages!

Parameters
array$itemAs returned by parseGettextSection
string$algorithmAlgorithm used to generate message keys: simple or legacy
Returns
string

Definition at line 323 of file GettextFFS.php.

◆ getFileExtensions()

GettextFFS::getFileExtensions ( )

Return the commonly used file extensions for these formats.

Include the dot.

Returns
string[]
Since
2013-04

Reimplemented from SimpleFFS.

Definition at line 32 of file GettextFFS.php.

◆ parseFlags()

static GettextFFS::parseFlags ( $section)
static

Definition at line 293 of file GettextFFS.php.

◆ parseGettext()

GettextFFS::parseGettext ( $data)

Definition at line 77 of file GettextFFS.php.

◆ parseGettextData()

static GettextFFS::parseGettextData ( $data,
$useCtxtAsKey,
StringMangler $mangler,
$keyAlgorithm,
bool $allowPotMode )
static

Parses gettext file as string into internal representation.

Parameters
string$data
bool$useCtxtAsKeyWhether to create message keys from the context or use msgctxt (non-standard po-files)
StringMangler$mangler
string$keyAlgorithmKey generation algorithm, see generateKeyFromItem
bool$allowPotMode
Exceptions
MWException
Returns
array

Definition at line 99 of file GettextFFS.php.

◆ parseGettextSection()

static GettextFFS::parseGettextSection ( $section,
$pluralCount )
static

Definition at line 192 of file GettextFFS.php.

◆ parseHeaderTags()

static GettextFFS::parseHeaderTags ( $headers)
static

Definition at line 381 of file GettextFFS.php.

◆ processGettextPluralMessage()

static GettextFFS::processGettextPluralMessage ( $pluralCount,
$section )
static

Definition at line 272 of file GettextFFS.php.

◆ read()

GettextFFS::read ( $code)

@inheritDoc

Reimplemented from SimpleFFS.

Definition at line 42 of file GettextFFS.php.

◆ readFromVariable()

GettextFFS::readFromVariable ( $data)
Parameters
string$data
Returns
array

Reimplemented from SimpleFFS.

Definition at line 58 of file GettextFFS.php.

◆ setOfflineMode()

GettextFFS::setOfflineMode ( $value)
Parameters
bool$value

Definition at line 37 of file GettextFFS.php.

◆ supportsFuzzy()

GettextFFS::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 28 of file GettextFFS.php.

◆ writeReal()

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

Reimplemented from SimpleFFS.

Definition at line 394 of file GettextFFS.php.

Member Data Documentation

◆ $offlineMode

GettextFFS::$offlineMode = false
protected

Definition at line 26 of file GettextFFS.php.


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