diff options
Diffstat (limited to 'MLEB/Translate/messagegroups/MessageGroupOld.php')
-rw-r--r-- | MLEB/Translate/messagegroups/MessageGroupOld.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/MLEB/Translate/messagegroups/MessageGroupOld.php b/MLEB/Translate/messagegroups/MessageGroupOld.php index bd56f362..0eec3d0a 100644 --- a/MLEB/Translate/messagegroups/MessageGroupOld.php +++ b/MLEB/Translate/messagegroups/MessageGroupOld.php @@ -166,7 +166,7 @@ abstract class MessageGroupOld implements MessageGroup { */ public function getMangler() { if ( !isset( $this->mangler ) ) { - $this->mangler = StringMatcher::EmptyMatcher(); + $this->mangler = new StringMatcher(); } return $this->mangler; @@ -185,7 +185,7 @@ abstract class MessageGroupOld implements MessageGroup { * this message group handles. * * @throws MWException - * @return Array of messages definitions indexed by key. + * @return string[] List of message definitions indexed by key. */ public function getDefinitions() { $defs = $this->load( $this->getSourceLanguage() ); @@ -207,6 +207,13 @@ abstract class MessageGroupOld implements MessageGroup { } /** + * @inheritDoc + */ + public function getKeys() { + return array_keys( $this->getDefinitions() ); + } + + /** * Returns of stored translation of message specified by the $key in language * code $code. * @@ -220,7 +227,7 @@ abstract class MessageGroupOld implements MessageGroup { } $key = strtolower( str_replace( ' ', '_', $key ) ); - return isset( $this->messages[$code][$key] ) ? $this->messages[$code][$key] : null; + return $this->messages[$code][$key] ?? null; } public static function normaliseKeys( $array ) { @@ -300,18 +307,15 @@ abstract class MessageGroupOld implements MessageGroup { return $collection; } - public function __construct() { - } - /** - * Can be overwritten to retun false if something is wrong. + * Can be overwritten to return false if something is wrong. * @return bool */ public function exists() { return true; } - public function getChecker() { + public function getValidator() { return null; } @@ -325,7 +329,7 @@ abstract class MessageGroupOld implements MessageGroup { return $tags; } - return isset( $tags[$type] ) ? $tags[$type] : []; + return $tags[$type] ?? []; } /** @@ -344,6 +348,7 @@ abstract class MessageGroupOld implements MessageGroup { } public function getConfiguration() { + return []; } public function getFFS() { @@ -373,6 +378,8 @@ abstract class MessageGroupOld implements MessageGroup { // @todo Replace deprecated call. $conf = $this->getWorkflowConfiguration(); + Hooks::run( 'Translate:modifyMessageGroupStates', [ $this->getId(), &$conf ] ); + return new MessageGroupStates( $conf ); } |