28 return (
bool)$this->conf[
'GROUPS'];
32 public function load( $code ) {
35 foreach ( $this->
getGroups() as $group ) {
36 $messages += $group->load( $code );
44 if ( $this->mangler ===
null ) {
48 return $this->mangler;
56 if ( $this->groups === null ) {
58 $ids = (array)$this->conf[
'GROUPS'];
59 $ids = MessageGroups::expandWildcards( $ids );
61 foreach ( $ids as $id ) {
63 if ( $id === $this->
getId() ) {
67 $group = MessageGroups::getGroup( $id );
68 if ( $group ===
null ) {
69 error_log(
"Invalid group id in {$this->getId()}: $id" );
73 if ( MessageGroups::getPriority( $group ) ===
'discouraged' ) {
77 $groups[$id] = $group;
80 $this->groups = $groups;
86 protected function loadMessagesFromCache( $groups ) {
88 foreach ( $groups as $group ) {
90 $messages += $group->getDefinitions();
94 if ( $group instanceof
self ) {
95 $messages += $this->loadMessagesFromCache( $group->getGroups() );
98 '@phan-var FileBasedMessageGroup $group';
100 $cache = $group->getMessageGroupCache( $group->getSourceLanguage() );
101 if ( $cache->exists() ) {
102 foreach ( $cache->getKeys() as $key ) {
103 $messages[$key] = $cache->get( $key );
113 $messages = $this->loadMessagesFromCache( $this->getGroups() );
114 $namespace = $this->getNamespace();
116 $collection = MessageCollection::newFromDefinitions( $definitions, $code );
118 $this->setTags( $collection );
132 $title = Title::makeTitle( $this->getNamespace(), $key );
134 $groupId = MessageIndex::getPrimaryGroupId( $handle );
135 if ( $groupId ===
null ) {
136 error_log(
"Could not determine groupId for MessageHandle of key $key" );
139 if ( $groupId === $this->getId() ) {
142 error_log(
"AggregateMessageGroup $groupId cannot be primary owner of key $key" );
147 $group = MessageGroups::getGroup( $groupId );
149 return $group->getMessage( $key, $code );
159 foreach ( $this->getGroups() as $group ) {
160 $tags = array_merge_recursive( $tags, $group->getTags( $type ) );
169 foreach ( $this->getGroups() as $group ) {
172 foreach ( $group->getKeys() as $key ) {
177 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 some basic functions that wrap around the YAML message group configurations.
getId()
Returns the unique identifier for this group.
This is the interface and base implementation of unmanaged message groups.
Class for pointing to messages, like Title class is for titles.