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

JavaFormat class implements support for Java properties files. More...

Inheritance diagram for MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat:
MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat MediaWiki\Extension\Translate\MessageGroupConfiguration\MetaYamlSchemaExtender MediaWiki\Extension\Translate\FileFormatSupport\FileFormatSupport

Public Member Functions

 __construct (FileBasedMessageGroup $group)
 
 supportsFuzzy ()
 Query the capabilities of this FFS.
 
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 
 readFromVariable (string $data)
 
 writeRow (string $key, string $value)
 Writes well-formed properties file row with key and value.
 
 readRow (string $line, string $sep)
 Parses non-empty properties file row to key and value.
 
- Public Member Functions inherited from MediaWiki\Extension\Translate\FileFormatSupport\SimpleFormat
 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 ()
 Return a data structure that will be merged with the base schema.
 

Public Attributes

 $messages = $this->group->getMangler()->mangleArray( $messages )
 
 return ['AUTHORS'=> $authors, 'MESSAGES'=> $messages,]
 

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.
 

Additional Inherited Members

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

Detailed Description

JavaFormat class implements support for Java properties files.

This class reads and writes only utf-8 files. Java projects need to run native2ascii on them before using them.

This class adds a new item into FILES section of group configuration: keySeparator which defaults to '='.

Definition at line 23 of file JavaFormat.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::__construct ( FileBasedMessageGroup $group)

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

Definition at line 27 of file JavaFormat.php.

Member Function Documentation

◆ getExtraSchema()

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

Return a data structure that will be merged with the base schema.

It is not possible to remove things.

Implements MediaWiki\Extension\Translate\MessageGroupConfiguration\MetaYamlSchemaExtender.

Definition at line 228 of file JavaFormat.php.

◆ getFileExtensions()

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::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 36 of file JavaFormat.php.

◆ readFromVariable()

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::readFromVariable ( string $data)
Exceptions
RuntimeException

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

Definition at line 41 of file JavaFormat.php.

◆ readRow()

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::readRow ( string $line,
string $sep )

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

Returns
string[]

Definition at line 147 of file JavaFormat.php.

◆ supportsFuzzy()

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::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 32 of file JavaFormat.php.

◆ writeReal()

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

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

Definition at line 98 of file JavaFormat.php.

◆ writeRow()

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

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

Definition at line 132 of file JavaFormat.php.

Member Data Documentation

◆ $messages

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::$messages = $this->group->getMangler()->mangleArray( $messages )

Definition at line 90 of file JavaFormat.php.

◆ return

MediaWiki\Extension\Translate\FileFormatSupport\JavaFormat::return[ 'AUTHORS'=> $authors, 'MESSAGES'=> $messages,]

Definition at line 92 of file JavaFormat.php.


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