Factory class for accessing message groups individually by id or all of them as a list.
More...
|
| recache () |
| Immediately update the cache.
|
|
| clearProcessCache () |
| Manually reset the process cache.
|
|
| setCache (?WANObjectCache $cache=null) |
| Override cache, for example during tests.
|
|
| getCacheKey () |
| Returns the cache key.
|
|
| getGroups () |
| Get all enabled non-dynamic message groups.
|
|
|
static | appendAutoloader (array &$additions, array &$to) |
| Safely merges first array to second array, throwing warning on duplicates and removing duplicates from the first array.
|
|
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 33 of file MessageGroups.php.
◆ appendAutoloader()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::appendAutoloader |
( |
array & | $additions, |
|
|
array & | $to ) |
|
staticprotected |
Safely merges first array to second array, throwing warning on duplicates and removing duplicates from the first array.
- Parameters
-
array | &$additions | Things to append |
array | &$to | Where to append |
Definition at line 212 of file MessageGroups.php.
◆ clearCache()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::clearCache |
( |
| ) |
|
|
static |
Manually reset group cache.
Use when automatic dependency tracking fails.
Definition at line 162 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 181 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 568 of file MessageGroups.php.
◆ getAllGroups()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getAllGroups |
( |
| ) |
|
|
static |
◆ getCache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getCache |
( |
| ) |
|
|
protected |
◆ getCachedGroupDefinitions()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getCachedGroupDefinitions |
( |
| $recache = false | ) |
|
|
protected |
- Parameters
-
bool | string | $recache | Either "recache" or false |
Definition at line 67 of file MessageGroups.php.
◆ getCacheGroupLoaders()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::getCacheGroupLoaders |
( |
| ) |
|
|
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 284 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 542 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 616 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]]
- Exceptions
-
MWException | If cyclic structure is detected. |
- Returns
- array Map of (group ID => MessageGroup or recursive array)
Definition at line 638 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 447 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 349 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 424 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 763 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 124 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 786 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 325 of file MessageGroups.php.
◆ normalizeId()
static MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::normalizeId |
( |
?string | $id | ) |
|
|
static |
◆ recache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::recache |
( |
| ) |
|
◆ setCache()
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups::setCache |
( |
?WANObjectCache | $cache = null | ) |
|
◆ 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 384 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] |
- Exceptions
-
- Returns
- array
Definition at line 712 of file MessageGroups.php.
The documentation for this class was generated from the following file: