14use MediaWiki\Title\Title;
31 return (
bool)$this->conf[
'GROUPS'];
35 public function load( $code ) {
38 foreach ( $this->
getGroups() as $group ) {
39 $messages += $group->load( $code );
47 if ( $this->mangler ===
null ) {
51 return $this->mangler;
59 if ( $this->groups === null ) {
61 $ids = (array)$this->conf[
'GROUPS'];
62 $ids = MessageGroups::expandWildcards( $ids );
64 foreach ( $ids as $id ) {
66 if ( $id === $this->
getId() ) {
70 $group = MessageGroups::getGroup( $id );
71 if ( $group ===
null ) {
72 error_log(
"Invalid group id in {$this->getId()}: $id" );
76 if ( MessageGroups::getPriority( $group ) ===
'discouraged' ) {
80 $groups[$id] = $group;
83 $this->groups = $groups;
89 protected function loadMessagesFromCache( $groups ) {
91 foreach ( $groups as $group ) {
92 if ( $group instanceof
self ) {
93 $messages += $this->loadMessagesFromCache( $group->getGroups() );
98 $cache = $group->getMessageGroupCache( $group->getSourceLanguage() );
99 if ( $cache->exists() ) {
100 foreach ( $cache->getKeys() as $key ) {
101 $messages[$key] = $cache->get( $key );
107 $messages += $group->getDefinitions();
115 $messages = $this->loadMessagesFromCache( $this->getGroups() );
116 $namespace = $this->getNamespace();
118 $collection = MessageCollection::newFromDefinitions( $definitions, $code );
120 $this->setTags( $collection );
134 $title = Title::makeTitle( $this->getNamespace(), $key );
136 $groupId = Services::getInstance()->getMessageIndex()->getPrimaryGroupId( $handle );
137 if ( $groupId ===
null ) {
138 error_log(
"Could not determine groupId for MessageHandle of key $key" );
141 if ( $groupId === $this->getId() ) {
144 error_log(
"AggregateMessageGroup $groupId cannot be primary owner of key $key" );
149 $group = MessageGroups::getGroup( $groupId );
151 return $group->getMessage( $key, $code );
161 foreach ( $this->getGroups() as $group ) {
162 $tags = array_merge_recursive( $tags, $group->getTags( $type ) );
171 foreach ( $this->getGroups() as $group ) {
174 foreach ( $group->getKeys() as $key ) {
179 return array_values( array_unique( $keys ) );
Groups multiple message groups together as one group.
initCollection( $code)
@inheritDoc
getMessage( $key, $code)
@inheritDoc
getGroups()
Returns a list of message groups that this group consists of.
getTags( $type=null)
@inheritDoc
This class implements default behavior for file based message groups.
This class implements some basic functions that wrap around the YAML message group configurations.
getId()
Returns the unique identifier for this group.