MessageGroups Class Reference

Factory class for accessing message groups individually by id or all of them as an list. More...

List of all members.

Public Member Functions

 getGroups ()
 Get all enabled non-dynamic message groups.

Static Public Member Functions

static init ()
 Initialises the list of groups (but not the groups itself if possible).
static clearCache ()
 Manually reset group cache.
static getGroup ($id)
 Fetch a message group by id.
static exists ($id)
static getAllGroups ()
 Get all enabled message groups.
static getPriority ($group)
 We want to de-emphasize time sensitive groups like news for 2009.
static setPriority ($group, $priority= '')
 Sets the message group priority.
static isDynamic (MessageGroup $group)
static getSharedGroups (MessageGroup $group)
 Returns a list of message groups that share (certain) messages with this group.
static singleton ()
 Constructor function.
static getGroupsById (array $ids, $skipMeta=false)
 Get message groups for corresponding message group ids.
static expandWildcards ($ids)
 If the list of message group ids contains wildcards, this function will match them against the list of all supported message groups and return matched message group ids.
static getDynamicGroups ()
 Contents on these groups changes on a whim.
static getGroupsByType ($type)
 Get only groups of specific type (class).
static collectGroupIds ($value, $key, $used)
 See getGroupStructure, just collects ids into array.
static groupLabelSort ($a, $b)
 Sorts groups by label value.
static subGroups (AggregateMessageGroup $parent)
 Like getGroupStructure but start from one root which must be an AggregateMessageGroup.
static haveSingleSourceLanguage (array $groups)
 Checks whether all the message groups have the same source language.
static isTranslatableMessage (MessageHandle $handle)
 Filters out messages that should not be translated under normal conditions.

Static Protected Member Functions

static getCache ()
 Returns a cacher object.
static loadGroupDefinitions ()
 This constructs the list of all groups from multiple different sources.
static getAggregateGroups ()
 Get all the aggregate messages groups defined in translate_metadata table.

Static Protected Attributes

static $prioritycache = null
static $groups = null

Private Member Functions

 __construct ()

Detailed Description

Factory class for accessing message groups individually by id or all of them as an list.

Todo:
Clean up the mixed static/member method interface.

Definition at line 17 of file MessageGroups.php.


Constructor & Destructor Documentation

MessageGroups::__construct (  )  [private]

Definition at line 391 of file MessageGroups.php.


Member Function Documentation

static MessageGroups::clearCache (  )  [static]
static MessageGroups::collectGroupIds ( value,
key,
used 
) [static]

See getGroupStructure, just collects ids into array.

Definition at line 577 of file MessageGroups.php.

static MessageGroups::exists ( id  )  [static]
Parameters:
string $id
Returns:
bool

Definition at line 200 of file MessageGroups.php.

Referenced by SpecialImportTranslations::execute().

Here is the call graph for this function:

static MessageGroups::expandWildcards ( ids  )  [static]

If the list of message group ids contains wildcards, this function will match them against the list of all supported message groups and return matched message group ids.

Parameters:
string[]|string $ids
Returns:
string[]
Since:
2012-02-13

Definition at line 458 of file MessageGroups.php.

Referenced by AggregateMessageGroup::getGroups().

static MessageGroups::getAggregateGroups (  )  [static, protected]

Get all the aggregate messages groups defined in translate_metadata table.

Returns:
array
Since:
2012-05-09 return value changed

Definition at line 661 of file MessageGroups.php.

Referenced by loadGroupDefinitions().

Here is the call graph for this function:

static MessageGroups::getAllGroups (  )  [static]
static MessageGroups::getCache (  )  [static, protected]

Returns a cacher object.

Returns:
BagOStuff

Definition at line 68 of file MessageGroups.php.

Referenced by clearCache().

static MessageGroups::getDynamicGroups (  )  [static]

Contents on these groups changes on a whim.

Since:
2011-12-28

Definition at line 475 of file MessageGroups.php.

Referenced by getGroup(), and SpecialTranslate::groupSelector().

static MessageGroups::getGroup ( id  )  [static]

Fetch a message group by id.

Parameters:
string $id Message group id.
Returns:
MessageGroup|null if it doesn't exist.

Definition at line 170 of file MessageGroups.php.

Referenced by MessageGroupCache::__construct(), WikiWriter::__construct(), SpecialPageTranslation::classifyPages(), SpecialPageTranslation::execute(), ApiTranslationAids::execute(), ApiGroupReview::execute(), ApiAggregateGroups::execute(), exists(), MessageGroupStats::forGroup(), MessageGroupStats::forItem(), ApiTranslationStash::formatTranslation(), SpecialTranslationStats::getData(), ApiQueryMessageGroupStats::getData(), AggregateMessageGroup::getGroups(), getGroupsById(), MessageGroupStatesUpdaterJob::getGroupsWithTransitions(), AggregateMessageGroup::getMessage(), SandboxMessageGroup::getMessageContent(), RecentMessageGroup::getMessageContent(), TranslationHelpers::getMessageGroup(), TranslatablePage::getMessageGroup(), CoreMessageGroup::getUniqueDefinitions(), SpecialLanguageStats::getWorkflowStateCell(), TranslateUtils::groupSelector(), SpecialTranslate::groupSelector(), PoImporter::initMessages(), StatsTable::isBlacklisted(), SpecialMessageGroupStats::isValidValue(), CoreMessageGroup::load(), TranslationStatsBase::namespacesFromGroups(), SpecialManageGroups::processSubmit(), MessageGroupStatesUpdaterJob::run(), SpecialTranslate::setup(), SpecialManageGroups::showChanges(), MessageGroupStatesUpdaterJobTest::testGetNewState(), MessageGroupsTest::testGetParentGroups(), MessageGroupsTest::testHaveSingleSourceLanguage(), MessageGroupStatesUpdaterJobTest::testHooks(), and SpecialTranslate::tuxGroupSelector().

Here is the call graph for this function:

MessageGroups::getGroups (  ) 

Get all enabled non-dynamic message groups.

Returns:
array

Definition at line 411 of file MessageGroups.php.

Here is the call graph for this function:

static MessageGroups::getGroupsById ( array $  ids,
skipMeta = false 
) [static]

Get message groups for corresponding message group ids.

Parameters:
string[] $ids Group IDs
bool $skipMeta Skip aggregate message groups
Returns:
array
Since:
2012-02-13

Definition at line 431 of file MessageGroups.php.

Referenced by SpecialAggregateGroups::listSubgroups().

Here is the call graph for this function:

static MessageGroups::getGroupsByType ( type  )  [static]

Get only groups of specific type (class).

Parameters:
string $type Class name of wanted type
Returns:
MessageGroupBase[]
Since:
2012-04-30

Definition at line 489 of file MessageGroups.php.

Here is the call graph for this function:

static MessageGroups::getPriority ( group  )  [static]

We want to de-emphasize time sensitive groups like news for 2009.

They can still exist in the system, but should not appear in front of translators looking to do some useful work.

Parameters:
MessageGroup|string $group Message group ID
Returns:
string Message group priority
Since:
2011-12-12

Definition at line 221 of file MessageGroups.php.

Referenced by SpecialPageTranslation::classifyPages(), SpecialPageTranslation::execute(), ApiQueryMessageGroups::formatGroup(), AggregateMessageGroup::getGroups(), SpecialTranslate::groupSelector(), TranslateHooks::hideDiscouragedFromStats(), and SpecialAggregateGroups::listSubgroups().

static MessageGroups::getSharedGroups ( MessageGroup group  )  [static]

Returns a list of message groups that share (certain) messages with this group.

Since:
2011-12-25; renamed in 2012-12-10 from getParentGroups.
Parameters:
MessageGroup $group
Returns:
string[]

Definition at line 292 of file MessageGroups.php.

Referenced by SpecialPageTranslation::execute().

Here is the call graph for this function:

static MessageGroups::groupLabelSort ( a,
b 
) [static]

Sorts groups by label value.

Definition at line 582 of file MessageGroups.php.

static MessageGroups::haveSingleSourceLanguage ( array $  groups  )  [static]

Checks whether all the message groups have the same source language.

Parameters:
array $groups A list of message groups objects.
Returns:
string Language code if the languages are the same, empty string otherwise.
Since:
2013.09

Definition at line 639 of file MessageGroups.php.

Referenced by MessageGroupsTest::testHaveSingleSourceLanguage().

static MessageGroups::init (  )  [static]

Initialises the list of groups (but not the groups itself if possible).

Definition at line 26 of file MessageGroups.php.

Referenced by getGroup(), and getGroups().

Here is the call graph for this function:

static MessageGroups::isDynamic ( MessageGroup group  )  [static]
static MessageGroups::isTranslatableMessage ( MessageHandle handle  )  [static]

Filters out messages that should not be translated under normal conditions.

Parameters:
MessageHandle $handle Handle for the translation target.
Returns:
boolean
Since:
2013.10

Definition at line 698 of file MessageGroups.php.

Referenced by SandboxMessageGroup::getDefinitions(), and RecentAdditionsMessageGroup::matchingMessage().

Here is the call graph for this function:

static MessageGroups::loadGroupDefinitions (  )  [static, protected]

This constructs the list of all groups from multiple different sources.

When possible, a cache dependency is created to automatically recreate the cache when configuration changes.

Todo:
Reduce the ways of which messages can be added. Target is just to have three ways: Yaml files, translatable pages and with the hook.

Definition at line 79 of file MessageGroups.php.

Referenced by init().

Here is the call graph for this function:

static MessageGroups::setPriority ( group,
priority = '' 
) [static]

Sets the message group priority.

See also:
MessageGroups::getPriority
Parameters:
MessageGroup|string $group Message group
string $priority Priority (empty string to unset)
Since:
2013-03-01

Definition at line 252 of file MessageGroups.php.

Referenced by SpecialPageTranslation::execute().

static MessageGroups::singleton (  )  [static]
static MessageGroups::subGroups ( AggregateMessageGroup parent  )  [static]

Like getGroupStructure but start from one root which must be an AggregateMessageGroup.

Parameters:
AggregateMessageGroup $parent
Exceptions:
MWException 
Returns:
array
Since:
Public since 2012-11-29

Definition at line 598 of file MessageGroups.php.

Here is the call graph for this function:


Member Data Documentation

MessageGroups::$groups = null [static, protected]

Definition at line 23 of file MessageGroups.php.

Referenced by getAggregateGroups(), getGroupsById(), and getGroupsByType().

MessageGroups::$prioritycache = null [static, protected]

Definition at line 21 of file MessageGroups.php.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:49 2013 for MediaWiki Translate Extension by  doxygen 1.6.3