Interface for message groups. More...
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. | |
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.
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.
Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getDefinitions | ( | ) |
Shortcut for load( getSourceLanguage() ).
Implemented in MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentMessageGroup, SandboxMessageGroup, SubsetMessageGroup, WikiMessageGroup, WikiPageMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getDescription | ( | ?IContextSource | $context = null | ) |
Returns a longer description about the group.
Description can use wikitext. Parameter $context was added in 2012-10-22.
IContextSource | null | $context | Context can be used by subclasses to provide translated descriptions, for example. |
Implemented in MediaWikiExtensionMessageGroup, MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentAdditionsMessageGroup, RecentMessageGroup, SandboxMessageGroup, WikiPageMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getIcon | ( | ) |
Returns an icon for this message group if any.
Implemented in MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getId | ( | ) |
Returns the unique identifier for this group.
Implemented in MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentAdditionsMessageGroup, RecentMessageGroup, SandboxMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getKeys | ( | ) |
Shortcut for array_keys( getDefinitions() ) that can be optimized by the implementing classes.
Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getLabel | ( | ?IContextSource | $context = null | ) |
Returns the human readable label (as plain text).
Parameter $context was added in 2012-10-22.
IContextSource | null | $context | Context can be used by subclasses to provide translated descriptions, for example. |
Implemented in MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentAdditionsMessageGroup, RecentMessageGroup, SandboxMessageGroup, WikiPageMessageGroup, WorkflowStatesMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getMangler | ( | ) |
Return a message mangler or null.
Implemented in AggregateMessageGroup, MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getMessage | ( | $key, | |
$code ) |
Returns the definition or translation for given message key in given language code.
string | $key | Message key |
string | $code | Language code |
Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, WikiMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getMessageGroupStates | ( | ) |
Get the message group workflow state configuration.
Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getNamespace | ( | ) |
Returns the namespace where messages are placed.
Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getRelatedPage | ( | ) |
Returns the page where the messages in the group are defined.
Implemented in MessageGroupBase, MessageGroupOld, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getSourceLanguage | ( | ) |
Returns language code depicting the language of source text.
Implemented in MessageGroupBase, MessageGroupOld, WikiMessageGroup, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getSupportConfig | ( | ) |
Gets support URL defined for the group if any.
Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
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.
string | null | $type |
Implemented in AggregateMessageGroup, MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getTranslatableLanguages | ( | ) |
Get all the translatable languages for a group, considering the inclusion and exclusion list.
Implemented in MessageGroupBase, MessageGroupOld, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::getValidator | ( | ) |
Returns a message validator object or null.
Implemented in MessageGroupBase, MessageGroupOld, MessagePrefixMessageGroup, RecentMessageGroup, SandboxMessageGroup, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::initCollection | ( | $code | ) |
Initialises a message collection with the given language code, message definitions and message tags.
string | $code |
Implemented in AggregateMessageGroup, FileBasedMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
MessageGroup::isMeta | ( | ) |
Implemented in MessageGroupBase, MessageGroupOld, SubsetMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.
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).
string | $code |
Implemented in AggregateMessageGroup, FileBasedMessageGroup, MessageGroupOld, SubsetMessageGroup, WikiPageMessageGroup, and MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroup.