Factory class for accessing message groups individually by id or all of them as a list.
More...
Factory class for accessing message groups individually by id or all of them as a list.
- Todo
- Clean up the mixed static/member method interface.
- Author
- Niklas Laxström
-
Siebrand Mazeland
- Copyright
- Copyright © 2008-2013, Niklas Laxström, Siebrand Mazeland @license GPL-2.0-or-later
Definition at line 30 of file MessageGroups.php.
◆ clearProcessCache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::clearProcessCache |
( |
| ) |
|
Manually reset the process cache.
This is helpful for long-running scripts where the process cache might get stale even though the global cache is updated.
Definition at line 94 of file MessageGroups.php.
◆ exists()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::exists |
( |
string | $id | ) |
|
|
static |
◆ expandWildcards()
static MediaWiki\Extension\Translate\MessageGroupProcessing\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
-
- Returns
- string[]
Definition at line 425 of file MessageGroups.php.
◆ getAllGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getAllGroups |
( |
| ) |
|
|
static |
◆ getCache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getCache |
( |
| ) |
|
|
protected |
◆ getCacheKey()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getCacheKey |
( |
| ) |
|
◆ getDynamicGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getDynamicGroups |
( |
| ) |
|
|
static |
◆ getGroup()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroup |
( |
string | $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 173 of file MessageGroups.php.
◆ getGroupLoaders()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroupLoaders |
( |
| ) |
|
|
protected |
◆ getGroups()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroups |
( |
| ) |
|
◆ getGroupsById()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroupsById |
( |
array | $ids, |
|
|
bool | $skipMeta = false ) |
|
static |
Get message groups for corresponding message group ids.
- Parameters
-
string[] | $ids | Group IDs |
bool | $skipMeta | Skip aggregate message groups |
- Returns
- MessageGroup[]
- Since
- 2012-02-13
Definition at line 399 of file MessageGroups.php.
◆ getGroupsByType()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroupsByType |
( |
string | $type | ) |
|
|
static |
Get only groups of specific type (class).
@phan-template T
- Parameters
-
string | $type | Class name of wanted type @phan-param class-string<T> $type |
- Returns
- MessageGroup[] Map of (group ID => MessageGroupBase) @phan-return array<T&MessageGroup>
- Since
- 2012-04-30
Definition at line 473 of file MessageGroups.php.
◆ getGroupStructure()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getGroupStructure |
( |
| ) |
|
|
static |
Returns a tree of message groups.
First group in each subgroup is the aggregate group. Groups can be nested infinitely, though in practice other code might not handle more than two (or even one) nesting levels. One group can exist multiple times in different parts of the tree. In other words: [Group1, Group2, [AggGroup, Group3, Group4]]
- Returns
- array Map of (group ID => MessageGroup or recursive array)
Definition at line 494 of file MessageGroups.php.
◆ getParentGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getParentGroups |
( |
MessageGroup | $targetGroup | ) |
|
|
static |
Returns a list of parent message groups.
If message group exists in multiple places in the tree, multiple lists are returned.
Definition at line 304 of file MessageGroups.php.
◆ getPriority()
static MediaWiki\Extension\Translate\MessageGroupProcessing\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
-
- Returns
- string Message group priority
Definition at line 244 of file MessageGroups.php.
◆ getSharedGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getSharedGroups |
( |
MessageGroup | $group | ) |
|
|
static |
Returns a list of message groups that share (certain) messages with this group.
Definition at line 281 of file MessageGroups.php.
◆ groupLabelSort()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::groupLabelSort |
( |
MessageGroup | $a, |
|
|
MessageGroup | $b ) |
|
static |
◆ haveSingleSourceLanguage()
static MediaWiki\Extension\Translate\MessageGroupProcessing\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.
Definition at line 618 of file MessageGroups.php.
◆ init()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::init |
( |
| ) |
|
|
protected |
◆ initGroupsFromDefinitions()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::initGroupsFromDefinitions |
( |
array | $groups | ) |
|
|
protected |
Expand process cached groups to objects.
- Parameters
-
array | $groups | Map of (group ID => mixed) |
Definition at line 62 of file MessageGroups.php.
◆ isDynamic()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::isDynamic |
( |
MessageGroup | $group | ) |
|
|
static |
◆ isTranslatableMessage()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::isTranslatableMessage |
( |
MessageHandle | $handle, |
|
|
string | $targetLanguage ) |
|
static |
Filters out messages that should not be translated under normal conditions.
- Parameters
-
MessageHandle | $handle | Handle for the translation target. |
string | $targetLanguage | |
- Returns
- bool
Definition at line 641 of file MessageGroups.php.
◆ labelExists()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::labelExists |
( |
string | $name | ) |
|
|
static |
Check if a particular aggregate group label exists.
Definition at line 214 of file MessageGroups.php.
◆ normalizeId()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::normalizeId |
( |
?string | $id | ) |
|
|
static |
◆ overrideGroupsForTesting()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::overrideGroupsForTesting |
( |
array | $groups | ) |
|
◆ recache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::recache |
( |
| ) |
|
Clear message group caches and populate message groups from uncached data.
Definition at line 73 of file MessageGroups.php.
◆ setCache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::setCache |
( |
WANObjectCache | $cache | ) |
|
◆ setPriority()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::setPriority |
( |
| $group, |
|
|
string | $priority = '' ) |
|
static |
Sets the message group priority.
- Parameters
-
MessageGroup | string | $group | Message group |
string | $priority | Priority (empty string to unset) |
Definition at line 260 of file MessageGroups.php.
◆ singleton()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::singleton |
( |
| ) |
|
|
static |
◆ subGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::subGroups |
( |
AggregateMessageGroup | $parent, |
|
|
array & | $childIds = [], |
|
|
string | $fname = 'caller' ) |
|
static |
Like getGroupStructure but start from one root which must be an AggregateMessageGroup.
- Parameters
-
AggregateMessageGroup | $parent | |
string[] | &$childIds | Flat list of child group IDs [returned] |
string | $fname | Calling method name; used to identify recursion [optional] |
- Returns
- array
Definition at line 567 of file MessageGroups.php.
The documentation for this class was generated from the following file: