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

Group for messages that can be controlled via a page in MediaWiki namespace. More...

Inheritance diagram for WikiMessageGroup:
MessageGroupOld MessageGroup MessagePrefixMessageGroup RecentMessageGroup SandboxMessageGroup WorkflowStatesMessageGroup RecentAdditionsMessageGroup

Public Member Functions

 __construct ( $id, $source)
 
 getSourceLanguage ()
 Defaults to wiki content language.
 
 getDefinitions ()
 Fetch definitions from database.
 
 getMessage ( $key, $code)
 Returns of stored translation of message specified by the $key in language code $code.
 
- Public Member Functions inherited from MessageGroupOld
 getLabel (IContextSource $context=null)
 
 setLabel ( $value)
 
 getId ()
 
 setId ( $value)
 
 getNamespace ()
 Get the namespace where all the messages of this group belong.
 
 setNamespace ( $ns)
 Set the namespace where all the messages of this group belong.
 
 getDescription (IContextSource $context=null)
 Returns a longer description about the group.
 
 setDescription ( $value)
 
 getIcon ()
 Returns an icon for this message group if any.
 
 isMeta ()
 
 getMangler ()
 
 load ( $code)
 Returns a list of messages in a given language code.
 
 getUniqueDefinitions ()
 This function can be used for meta message groups to list their "own" messages.
 
 getKeys ()
 @inheritDoc
 
 getMessageFile ( $code)
 Returns path to the file where translation of language code $code are.
 
 getPath ()
 
 getMessageFileWithPath ( $code)
 
 getSourceFilePath ( $code)
 
 initCollection ( $code, $unique=false)
 Creates a new MessageCollection for this group.
 
 exists ()
 Can be overwritten to return false if something is wrong.
 
 getValidator ()
 Returns a message validator object or null.
 
 getTags ( $type=null)
 Returns message tags.
 
 getMessageGroupStates ()
 Get the message group workflow state configuration.
 
 getTranslatableLanguages ()
 @inheritDoc
 
 getTranslationAids ()
 List of available message types mapped to the classes implementing them.
 
 getSupportConfig ()
 Gets support URL defined for the group if any.
 
- Public Member Functions inherited from MessageGroup
 initCollection ( $code)
 Initialises a message collection with the given language code, message definitions and message tags.
 

Protected Attributes

 $source
 
- Protected Attributes inherited from MessageGroupOld
 $label = 'none'
 Human-readable name of this group.
 
 $id = 'none'
 Group-wide unique id of this group.
 
 $namespace = NS_MEDIAWIKI
 The namespace where all the messages of this group belong.
 
 $description = null
 Holds description of this group.
 
 $meta = false
 Meta groups consist of multiple groups or parts of other groups.
 
 $mangler = null
 To avoid key conflicts between groups or separated changed messages between branches one can set a message key mangler.
 
 $messages = []
 All the messages for this group, by language code.
 

Additional Inherited Members

- Static Public Member Functions inherited from MessageGroupOld
static normaliseKeys ( $array)
 
- Protected Member Functions inherited from MessageGroupOld
 isSourceLanguage ( $code)
 
- Static Protected Member Functions inherited from MessageGroupOld
static addContext (Message $message, IContextSource $context=null)
 

Detailed Description

Group for messages that can be controlled via a page in MediaWiki namespace.

In the page comments start with # and continue till the end of the line. The page should contain list of page names in MediaWiki namespace, without the namespace prefix. Use underscores for spaces in page names, since whitespace separates the page names from each other.

Definition at line 23 of file WikiMessageGroup.php.

Constructor & Destructor Documentation

◆ __construct()

WikiMessageGroup::__construct ( $id,
$source )
Parameters
string$idUnique id for this group.
string$sourceMediaWiki message that contains list of message keys.

Definition at line 30 of file WikiMessageGroup.php.

Member Function Documentation

◆ getDefinitions()

WikiMessageGroup::getDefinitions ( )

Fetch definitions from database.

Returns
array Array of messages keys with definitions.

Reimplemented from MessageGroupOld.

Reimplemented in MessagePrefixMessageGroup, RecentMessageGroup, SandboxMessageGroup, and WorkflowStatesMessageGroup.

Definition at line 49 of file WikiMessageGroup.php.

◆ getMessage()

WikiMessageGroup::getMessage ( $key,
$code )

Returns of stored translation of message specified by the $key in language code $code.

Parameters
string$keyKey of the message.
string$codeLanguage code.
Returns
string|null The translation or null if it doesn't exist.

Reimplemented from MessageGroupOld.

Definition at line 81 of file WikiMessageGroup.php.

◆ getSourceLanguage()

WikiMessageGroup::getSourceLanguage ( )

Defaults to wiki content language.

Returns
string Language code

Reimplemented from MessageGroupOld.

Definition at line 39 of file WikiMessageGroup.php.

Member Data Documentation

◆ $source

WikiMessageGroup::$source
protected

Definition at line 24 of file WikiMessageGroup.php.


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