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

This class implements default behavior for file based message groups. More...

Inheritance diagram for FileBasedMessageGroup:
MessageGroupBase MediaWiki\Extension\Translate\MessageGroupConfiguration\MetaYamlSchemaExtender MessageGroup MediaWikiExtensionMessageGroup

Public Member Functions

 getFFS ()
 
 exists ()
 If this function returns false, the message group is ignored and treated like it would not be configured at all.
 
 load ( $code)
 Returns a list of messages in a given language code.
 
 parseExternal (string $code)
 
 getSourceFilePath ( $code)
 
 getTargetFilename ( $code)
 
 replaceVariables ( $pattern, $code)
 
 mapCode ( $code)
 
 getKeys ()
 @inheritDoc
 
 initCollection ( $code)
 @inheritDoc
 
 getMessage ( $key, $code)
 @inheritDoc
 
 getMessageGroupCache (string $code)
 
- Public Member Functions inherited from MessageGroupBase
 getConfiguration ()
 
 getId ()
 Returns the unique identifier for this group.
 
 getLabel (?IContextSource $context=null)
 Returns the human readable label (as plain text).
 
 getDescription (?IContextSource $context=null)
 Returns a longer description about the group.
 
 getIcon ()
 Returns an icon for this message group if any.
 
 getNamespace ()
 Returns the namespace where messages are placed.
 
 isMeta ()
 
 getSourceLanguage ()
 Returns language code depicting the language of source text.
 
 getDefinitions ()
 Shortcut for load( getSourceLanguage() ).
 
 getValidator ()
 Returns a message validator object or null.
 
 getMangler ()
 Return a message mangler or null.
 
 getInsertablesSuggester ()
 Returns the configured InsertablesSuggester if any.
 
 getTags ( $type=null)
 Returns message tags.
 
 getMessageGroupStates ()
 Get the message group workflow state configuration.
 
 getTranslatableLanguages ()
 @inheritDoc
 
 getSupportConfig ()
 Gets support URL defined for the group if any.
 
 getRelatedPage ()
 @inheritDoc
 

Static Public Member Functions

static newFromMessageGroup (MessageGroup $group, string $targetPattern='')
 Constructs a FileBasedMessageGroup from any normal message group.
 
static getExtraSchema ()
 Return a data structure that will be merged with the base schema.
 
- Static Public Member Functions inherited from MessageGroupBase
static factory ( $conf)
 

Public Attributes

const NO_FILE_FORMAT = 1
 

Protected Attributes

 $reverseCodeMap
 
- Protected Attributes inherited from MessageGroupBase
 $conf
 
 $namespace
 
 $mangler
 

Additional Inherited Members

- Protected Member Functions inherited from MessageGroupBase
 getFromConf ( $section, $key=null)
 
 parseTags ( $patterns)
 
 getRawTags ( $type=null)
 
 setTags (MessageCollection $collection)
 
 parseNamespace ()
 
 isSourceLanguage ( $code)
 

Detailed Description

This class implements default behavior for file based message groups.

File based message groups are primary type of groups at translatewiki.net, while other projects may use mainly page translation message groups, or custom type of message groups.

Definition at line 27 of file FileBasedMessageGroup.php.

Member Function Documentation

◆ exists()

FileBasedMessageGroup::exists ( )

If this function returns false, the message group is ignored and treated like it would not be configured at all.

Useful for graceful degradation. Try to keep the check fast to avoid performance problems.

Returns
bool

Implements MessageGroup.

Definition at line 82 of file FileBasedMessageGroup.php.

◆ getExtraSchema()

static FileBasedMessageGroup::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 201 of file FileBasedMessageGroup.php.

◆ getFFS()

FileBasedMessageGroup::getFFS ( )

Definition at line 66 of file FileBasedMessageGroup.php.

◆ getKeys()

FileBasedMessageGroup::getKeys ( )

@inheritDoc

Reimplemented from MessageGroupBase.

Definition at line 240 of file FileBasedMessageGroup.php.

◆ getMessage()

FileBasedMessageGroup::getMessage ( $key,
$code )

@inheritDoc

Implements MessageGroup.

Definition at line 269 of file FileBasedMessageGroup.php.

◆ getMessageGroupCache()

FileBasedMessageGroup::getMessageGroupCache ( string $code)

Definition at line 294 of file FileBasedMessageGroup.php.

◆ getSourceFilePath()

FileBasedMessageGroup::getSourceFilePath ( $code)
Parameters
string$codeLanguage code.
Returns
string

Definition at line 116 of file FileBasedMessageGroup.php.

◆ getTargetFilename()

FileBasedMessageGroup::getTargetFilename ( $code)

Definition at line 132 of file FileBasedMessageGroup.php.

◆ initCollection()

FileBasedMessageGroup::initCollection ( $code)

@inheritDoc

Implements MessageGroup.

Definition at line 250 of file FileBasedMessageGroup.php.

◆ load()

FileBasedMessageGroup::load ( $code)

Returns a list of messages in a given language code.

For some groups that list may be identical with the translation in the wiki. For other groups the messages may be loaded from a file (and differ from the current translations or definitions).

Parameters
string$code
Returns
string[]

Implements MessageGroup.

Definition at line 86 of file FileBasedMessageGroup.php.

◆ mapCode()

FileBasedMessageGroup::mapCode ( $code)
Parameters
string$codeLanguage code.
Returns
string

Definition at line 181 of file FileBasedMessageGroup.php.

◆ newFromMessageGroup()

static FileBasedMessageGroup::newFromMessageGroup ( MessageGroup $group,
string $targetPattern = '' )
static

Constructs a FileBasedMessageGroup from any normal message group.

Useful for doing special Gettext exports from any group.

Parameters
MessageGroup$group
string$targetPatternValue for FILES.targetPattern
Returns
self

Definition at line 40 of file FileBasedMessageGroup.php.

◆ parseExternal()

FileBasedMessageGroup::parseExternal ( string $code)
Parameters
string$codeLanguage tag.
Returns
array Array with keys MESSAGES, AUTHORS and EXTRA, containing only primitive values.
Since
2020.04

Definition at line 98 of file FileBasedMessageGroup.php.

◆ replaceVariables()

FileBasedMessageGroup::replaceVariables ( $pattern,
$code )
Parameters
string$pattern
string$codeLanguage code.
Returns
string
Since
2014.02 Made public

Definition at line 164 of file FileBasedMessageGroup.php.

Member Data Documentation

◆ $reverseCodeMap

FileBasedMessageGroup::$reverseCodeMap
protected

Definition at line 31 of file FileBasedMessageGroup.php.

◆ NO_FILE_FORMAT

const FileBasedMessageGroup::NO_FILE_FORMAT = 1

Definition at line 28 of file FileBasedMessageGroup.php.


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