Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MessageGroup Interface Reference

Interface for message groups. More...

Inheritance diagram for MessageGroup:
MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup MessageGroupBase MessageGroupOld AggregateMessageGroup FileBasedMessageGroup SubsetMessageGroup WikiMessageGroup WikiPageMessageGroup MediaWikiExtensionMessageGroup MessagePrefixMessageGroup RecentMessageGroup SandboxMessageGroup WorkflowStatesMessageGroup RecentAdditionsMessageGroup

Public Member Functions

 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 ()
 
 exists ()
 If this function returns false, the message group is ignored and treated like it would not be configured at all.
 
 getValidator ()
 Returns a message validator object or null.
 
 getMangler ()
 Return a message mangler or null.
 
 initCollection ( $code)
 Initialises a message collection with the given language code, message definitions and message tags.
 
 load ( $code)
 Returns a list of messages in a given language code.
 
 getDefinitions ()
 Shortcut for load( getSourceLanguage() ).
 
 getKeys ()
 Shortcut for array_keys( getDefinitions() ) that can be optimized by the implementing classes.
 
 getTags ( $type=null)
 Returns message tags.
 
 getMessage ( $key, $code)
 Returns the definition or translation for given message key in given language code.
 
 getSourceLanguage ()
 Returns language code depicting the language of source text.
 
 getMessageGroupStates ()
 Get the message group workflow state configuration.
 
 getTranslatableLanguages ()
 Get all the translatable languages for a group, considering the inclusion and exclusion list.
 
 getSupportConfig ()
 Gets support URL defined for the group if any.
 
 getRelatedPage ()
 Returns the page where the messages in the group are defined.
 

Detailed Description

Interface for message groups.

Message groups are the heart of the Translate extension. They encapsulate a set of messages each. Aside from basic information like id, label and description, the class defines which mangler, validators and file system support (FFS), if any, the group uses.

Definition at line 28 of file MessageGroup.php.

Member Function Documentation

◆ exists()

MessageGroup::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

Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getDefinitions()

◆ getDescription()

MessageGroup::getDescription ( ?IContextSource $context = null)

Returns a longer description about the group.

Description can use wikitext. Parameter $context was added in 2012-10-22.

Parameters
IContextSource | null$contextContext can be used by subclasses to provide translated descriptions, for example.
Returns
string

Implemented in MediaWikiExtensionMessageGroup, MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentAdditionsMessageGroup, RecentMessageGroup, SandboxMessageGroup, WikiPageMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getIcon()

MessageGroup::getIcon ( )

Returns an icon for this message group if any.

Returns
string|null File reference in one of the supported protocols:
Since
2012-12-04

Implemented in MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getId()

◆ getKeys()

MessageGroup::getKeys ( )

Shortcut for array_keys( getDefinitions() ) that can be optimized by the implementing classes.

Returns
string[] List of message keys.

Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getLabel()

MessageGroup::getLabel ( ?IContextSource $context = null)

Returns the human readable label (as plain text).

Parameter $context was added in 2012-10-22.

Parameters
IContextSource | null$contextContext can be used by subclasses to provide translated descriptions, for example.
Returns
string

Implemented in MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentAdditionsMessageGroup, RecentMessageGroup, SandboxMessageGroup, WikiPageMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getMangler()

MessageGroup::getMangler ( )

Return a message mangler or null.

Todo
Make an interface for message manglers
Returns
\MediaWiki\Extension\Translate\MessageProcessing\StringMatcher|null

Implemented in AggregateMessageGroup, MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getMessage()

MessageGroup::getMessage ( $key,
$code )

Returns the definition or translation for given message key in given language code.

Parameters
string$keyMessage key
string$codeLanguage code
Returns
string|null

Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, WikiMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getMessageGroupStates()

MessageGroup::getMessageGroupStates ( )

Get the message group workflow state configuration.

Returns
MessageGroupStates

Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getNamespace()

MessageGroup::getNamespace ( )

Returns the namespace where messages are placed.

Returns
int

Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getRelatedPage()

MessageGroup::getRelatedPage ( )

Returns the page where the messages in the group are defined.

Implemented in MessageGroupBase, MessageGroupOld, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getSourceLanguage()

MessageGroup::getSourceLanguage ( )

Returns language code depicting the language of source text.

Returns
string

Implemented in MessageGroupBase, MessageGroupOld, WikiMessageGroup, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getSupportConfig()

MessageGroup::getSupportConfig ( )

Gets support URL defined for the group if any.

Returns
array|null

Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getTags()

MessageGroup::getTags ( $type = null)

Returns message tags.

If type is given, only message keys with that tag are returned. Otherwise an array[tag => keys] is returned.

Parameters
string | null$type
Returns
array

Implemented in AggregateMessageGroup, MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getTranslatableLanguages()

MessageGroup::getTranslatableLanguages ( )

Get all the translatable languages for a group, considering the inclusion and exclusion list.

Returns
array|null The language codes as array keys.

Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ getValidator()

MessageGroup::getValidator ( )

◆ initCollection()

MessageGroup::initCollection ( $code)

Initialises a message collection with the given language code, message definitions and message tags.

Parameters
string$code
Returns
MessageCollection

Implemented in AggregateMessageGroup, FileBasedMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ isMeta()

MessageGroup::isMeta ( )
Todo
Unclear usage. Perhaps rename to isSecondary with the only purpose suppress warnings about message key conflicts.
Returns
bool

Implemented in MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.

◆ load()

MessageGroup::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[]

Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.


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