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

Mixed bag of methods related to translatable pages. More...

Inheritance diagram for MediaWiki\Extension\Translate\PageTranslation\TranslatablePage:
MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle

Public Member Functions

 getTitle ()
 @inheritDoc
 
 getText ()
 Returns the text for this translatable page.
 
 getRevision ()
 Revision is null if object was constructed using newFromText.
 
 getSourceLanguageCode ()
 Returns the source language of this translatable page.
 
 getMessageGroupId ()
 @inheritDoc
 
 getMessageGroup ()
 Returns MessageGroup used for translating this page.
 
 hasPageDisplayTitle ()
 Check whether title is marked for translation.
 
 getPageDisplayTitle (string $languageCode)
 Get translated page title.
 
 getStrippedSourcePageText ()
 
 getTranslationPage (string $targetLanguage)
 
 addMarkedTag (int $revision, array $value=null)
 Adds a tag which indicates that this page is suitable for translation.
 
 addReadyTag (int $revision)
 Adds a tag which indicates that this page source is ready for marking for translation.
 
 getMarkedTag ()
 Returns the latest revision which has marked tag, if any.
 
 getReadyTag ()
 Returns the latest revision which has ready tag, if any.
 
 unmarkTranslatablePage ()
 Removes all page translation feature data from the database.
 
 getTranslationUrl ( $code=false)
 Produces a link to translation view of a translation page.
 
 getMarkedRevs ()
 
 getTranslationPages ()
 @inheritDoc
 
 getTranslationUnitPages (?string $code=null)
 @inheritDoc
 
 getTranslationPercentages ()
 
 getTransRev (string $suffix)
 
 supportsTransclusion ()
 
 setTransclusion (bool $supportsTransclusion)
 
 getRevisionRecordWithFallback ()
 
 isMoveable ()
 @inheritDoc
 
 isDeletable ()
 @inheritDoc
 

Static Public Member Functions

static newFromText (Title $title, string $text)
 Constructs a translatable page from given text.
 
static newFromRevision (Title $title, int $revision)
 Constructs a translatable page from given revision.
 
static newFromTitle (Title $title)
 Constructs a translatable page from title.
 
static getMessageGroupIdFromTitle (Title $title)
 Constructs MessageGroup id for any title.
 
static getTranslationPageFromTitle (Title $title)
 
static isTranslationPage (Title $title)
 
static parseTranslationUnit (LinkTarget $translationUnit)
 Helper to guess translation page from translation unit.
 
static isSourcePage (Title $title)
 
static clearSourcePageCache ()
 Clears the source page cache.
 

Public Attributes

const METADATA_KEYS
 List of keys in the metadata table that need to be handled for moves and deletions @phpcs-require-sorted-array.
 
const DISPLAY_TITLE_UNIT_ID = 'Page display title'
 

Protected Member Functions

 __construct (Title $title)
 
- Protected Member Functions inherited from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle
 getTranslationUnitPagesByTitle (Title $title, ?string $code=null)
 

Protected Attributes

 $title
 
 $revTagStore
 
 $text
 
 $revision
 
 $source
 
 $pageDisplayTitle
 

Static Protected Attributes

static $tagCache = []
 

Detailed Description

Mixed bag of methods related to translatable pages.

Author
Niklas Laxström @license GPL-2.0-or-later

Definition at line 35 of file TranslatablePage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::__construct ( Title $title)
protected
Parameters
Title$titleTitle object for the page

Definition at line 67 of file TranslatablePage.php.

Member Function Documentation

◆ addMarkedTag()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::addMarkedTag ( int $revision,
array $value = null )

Adds a tag which indicates that this page is suitable for translation.

Definition at line 282 of file TranslatablePage.php.

◆ addReadyTag()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::addReadyTag ( int $revision)

Adds a tag which indicates that this page source is ready for marking for translation.

Definition at line 288 of file TranslatablePage.php.

◆ clearSourcePageCache()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::clearSourcePageCache ( )
static

Clears the source page cache.

Definition at line 553 of file TranslatablePage.php.

◆ getMarkedRevs()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getMarkedRevs ( )

Definition at line 336 of file TranslatablePage.php.

◆ getMarkedTag()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getMarkedTag ( )

Returns the latest revision which has marked tag, if any.

Definition at line 296 of file TranslatablePage.php.

◆ getMessageGroup()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getMessageGroup ( )

Returns MessageGroup used for translating this page.

It may still be empty if the page has not been ever marked.

Definition at line 189 of file TranslatablePage.php.

◆ getMessageGroupId()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getMessageGroupId ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 176 of file TranslatablePage.php.

◆ getMessageGroupIdFromTitle()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getMessageGroupIdFromTitle ( Title $title)
static

Constructs MessageGroup id for any title.

Definition at line 181 of file TranslatablePage.php.

◆ getPageDisplayTitle()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getPageDisplayTitle ( string $languageCode)

Get translated page title.

Definition at line 218 of file TranslatablePage.php.

◆ getReadyTag()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getReadyTag ( )

Returns the latest revision which has ready tag, if any.

Definition at line 301 of file TranslatablePage.php.

◆ getRevision()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getRevision ( )

Revision is null if object was constructed using newFromText.

Returns
null|int

Definition at line 162 of file TranslatablePage.php.

◆ getRevisionRecordWithFallback()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getRevisionRecordWithFallback ( )

Definition at line 447 of file TranslatablePage.php.

◆ getSourceLanguageCode()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getSourceLanguageCode ( )

Returns the source language of this translatable page.

In other words the language in which the page without language code is written.

Since
2013-01-28

Definition at line 171 of file TranslatablePage.php.

◆ getStrippedSourcePageText()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getStrippedSourcePageText ( )

Definition at line 242 of file TranslatablePage.php.

◆ getText()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getText ( )

Returns the text for this translatable page.

Definition at line 123 of file TranslatablePage.php.

◆ getTitle()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTitle ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 118 of file TranslatablePage.php.

◆ getTranslationPage()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationPage ( string $targetLanguage)

Definition at line 259 of file TranslatablePage.php.

◆ getTranslationPageFromTitle()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationPageFromTitle ( Title $title)
static

Definition at line 250 of file TranslatablePage.php.

◆ getTranslationPages()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationPages ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 350 of file TranslatablePage.php.

◆ getTranslationPercentages()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationPercentages ( )

Definition at line 379 of file TranslatablePage.php.

◆ getTranslationUnitPages()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationUnitPages ( ?string $code = null)

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 375 of file TranslatablePage.php.

◆ getTranslationUrl()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTranslationUrl ( $code = false)

Produces a link to translation view of a translation page.

Parameters
string | bool$codeMediaWiki language code. Default: false.
Returns
string Relative url

Definition at line 323 of file TranslatablePage.php.

◆ getTransRev()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::getTransRev ( string $suffix)

Definition at line 416 of file TranslatablePage.php.

◆ hasPageDisplayTitle()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::hasPageDisplayTitle ( )

Check whether title is marked for translation.

Definition at line 203 of file TranslatablePage.php.

◆ isDeletable()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::isDeletable ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 466 of file TranslatablePage.php.

◆ isMoveable()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::isMoveable ( )

@inheritDoc

Reimplemented from MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundle.

Definition at line 461 of file TranslatablePage.php.

◆ isSourcePage()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::isSourcePage ( Title $title)
static

Definition at line 527 of file TranslatablePage.php.

◆ isTranslationPage()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::isTranslationPage ( Title $title)
static
Returns
bool|self

Definition at line 471 of file TranslatablePage.php.

◆ newFromRevision()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::newFromRevision ( Title $title,
int $revision )
static

Constructs a translatable page from given revision.

The revision must belong to the title given or unspecified behavior will happen.

Exceptions
MWException

Definition at line 91 of file TranslatablePage.php.

◆ newFromText()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::newFromText ( Title $title,
string $text )
static

Constructs a translatable page from given text.

Some functions will fail unless you set revision parameter manually.

Definition at line 77 of file TranslatablePage.php.

◆ newFromTitle()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::newFromTitle ( Title $title)
static

Constructs a translatable page from title.

The text of last marked revision is loaded when needed.

Definition at line 110 of file TranslatablePage.php.

◆ parseTranslationUnit()

static MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::parseTranslationUnit ( LinkTarget $translationUnit)
static

Helper to guess translation page from translation unit.

Definition at line 510 of file TranslatablePage.php.

◆ setTransclusion()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::setTransclusion ( bool $supportsTransclusion)

Definition at line 439 of file TranslatablePage.php.

◆ supportsTransclusion()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::supportsTransclusion ( )

Definition at line 430 of file TranslatablePage.php.

◆ unmarkTranslatablePage()

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::unmarkTranslatablePage ( )

Removes all page translation feature data from the database.

Does not remove translated sections or translation pages.

Definition at line 309 of file TranslatablePage.php.

Member Data Documentation

◆ $pageDisplayTitle

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$pageDisplayTitle
protected

Definition at line 62 of file TranslatablePage.php.

◆ $revision

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$revision
protected

Definition at line 58 of file TranslatablePage.php.

◆ $revTagStore

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$revTagStore
protected

Definition at line 54 of file TranslatablePage.php.

◆ $source

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$source
protected

Definition at line 60 of file TranslatablePage.php.

◆ $tagCache

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$tagCache = []
staticprotected

Definition at line 279 of file TranslatablePage.php.

◆ $text

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$text
protected

Definition at line 56 of file TranslatablePage.php.

◆ $title

MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::$title
protected

Definition at line 52 of file TranslatablePage.php.

◆ DISPLAY_TITLE_UNIT_ID

const MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::DISPLAY_TITLE_UNIT_ID = 'Page display title'

Definition at line 49 of file TranslatablePage.php.

◆ METADATA_KEYS

const MediaWiki\Extension\Translate\PageTranslation\TranslatablePage::METADATA_KEYS
Initial value:
= [
'maxid',
'priorityforce',
'prioritylangs',
'priorityreason',
'transclusion',
'version'
]

List of keys in the metadata table that need to be handled for moves and deletions @phpcs-require-sorted-array.

Definition at line 40 of file TranslatablePage.php.


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