Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker Class Reference

Service to mark/unmark pages from translation and perform related validations. More...

Public Member Functions

 __construct (IConnectionProvider $dbProvider, JobQueueGroup $jobQueueGroup, LinkRenderer $linkRenderer, MessageGroups $messageGroups, MessageIndex $messageIndex, TitleFormatter $titleFormatter, TitleParser $titleParser, TranslatablePageParser $translatablePageParser, TranslatablePageStore $translatablePageStore, TranslatablePageStateStore $translatablePageStateStore, TranslationUnitStoreFactory $translationUnitStoreFactory, MessageGroupMetadata $messageGroupMetadata, WikiPageFactory $wikiPageFactory, TranslatablePageView $translatablePageView, MessageGroupSubscription $messageGroupSubscription, FormatterFactory $formatterFactory)
 
 unmarkPage (TranslatablePage $page, User $user, MessageLocalizer $localizer, bool $removeMarkup)
 Remove a page from translation.
 
 getMarkOperation (PageRecord $page, ?int $revision, bool $validateUnitTitle)
 Parse the given page and create a new MarkPageOperation with the page and the given revision if the revision is latest and that latest revision is ready to be marked.
 
 markForTranslation (TranslatablePageMarkOperation $operation, TranslatablePageSettings $pageSettings, MessageLocalizer $localizer, User $user)
 This function does the heavy duty of marking a page.
 
 sendNotifications (array $sections, WikiPageMessageGroup $group, string $groupId, bool $isFirstMark)
 

Public Attributes

const LATEST_SYNTAX_VERSION = '2'
 
const DEFAULT_SYNTAX_VERSION = '1'
 

Detailed Description

Service to mark/unmark pages from translation and perform related validations.

Since
2023.10

Definition at line 41 of file TranslatablePageMarker.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::__construct ( IConnectionProvider $dbProvider,
JobQueueGroup $jobQueueGroup,
LinkRenderer $linkRenderer,
MessageGroups $messageGroups,
MessageIndex $messageIndex,
TitleFormatter $titleFormatter,
TitleParser $titleParser,
TranslatablePageParser $translatablePageParser,
TranslatablePageStore $translatablePageStore,
TranslatablePageStateStore $translatablePageStateStore,
TranslationUnitStoreFactory $translationUnitStoreFactory,
MessageGroupMetadata $messageGroupMetadata,
WikiPageFactory $wikiPageFactory,
TranslatablePageView $translatablePageView,
MessageGroupSubscription $messageGroupSubscription,
FormatterFactory $formatterFactory )

Definition at line 62 of file TranslatablePageMarker.php.

Member Function Documentation

◆ getMarkOperation()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::getMarkOperation ( PageRecord $page,
?int $revision,
bool $validateUnitTitle )

Parse the given page and create a new MarkPageOperation with the page and the given revision if the revision is latest and that latest revision is ready to be marked.

Parameters
PageRecord$page
?int$revisionRevision to use, or null to use the latest revision of the given page (i.e. not do the latest revision check)
Exceptions
TranslatablePageMarkExceptionIf the revision was provided and was non-latest, or if the latest revision of the page is not ready to be marked
ParsingFailureIf the parse fails

Definition at line 149 of file TranslatablePageMarker.php.

◆ markForTranslation()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::markForTranslation ( TranslatablePageMarkOperation $operation,
TranslatablePageSettings $pageSettings,
MessageLocalizer $localizer,
User $user )

This function does the heavy duty of marking a page.

  • Updates the source page with section markers.
  • Updates translate_sections table
  • Updates revtags table
  • Sets up renderjobs to update the translation pages
  • Invalidates caches
  • Adds interim cache for MessageIndex
Parameters
TranslatablePageMarkOperation$operation
TranslatablePageSettings$pageSettingsContains information about priority languages, units that should not be fuzzed, whether title should be translated and other translatable page settings
MessageLocalizer$localizer
User$userUser performing the action. Checking user permissions is the caller’s responsibility
Returns
int The number of translation units actually used

Definition at line 286 of file TranslatablePageMarker.php.

◆ sendNotifications()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::sendNotifications ( array $sections,
WikiPageMessageGroup $group,
string $groupId,
bool $isFirstMark )
Parameters
TranslationUnit[]$sections
WikiPageMessageGroup$group
string$groupId
bool$isFirstMark

Definition at line 557 of file TranslatablePageMarker.php.

◆ unmarkPage()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::unmarkPage ( TranslatablePage $page,
User $user,
MessageLocalizer $localizer,
bool $removeMarkup )

Remove a page from translation.

Parameters
TranslatablePage$pageThe page to remove from translation
User$userThe user performing the action
MessageLocalizer$localizer
bool$removeMarkupWhether to remove markup from the translation page
Exceptions
TranslatablePageMarkExceptionIf removing the markup from the translation page fails

Definition at line 106 of file TranslatablePageMarker.php.

Member Data Documentation

◆ DEFAULT_SYNTAX_VERSION

const MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::DEFAULT_SYNTAX_VERSION = '1'

Definition at line 43 of file TranslatablePageMarker.php.

◆ LATEST_SYNTAX_VERSION

const MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker::LATEST_SYNTAX_VERSION = '2'

Definition at line 42 of file TranslatablePageMarker.php.


The documentation for this class was generated from the following file: