This class represents one translation unit in a translatable page. More...
Public Member Functions | |
__construct (string $text, string $id=self::NEW_UNIT_ID, string $type='new', string $oldText=null) | |
setIsInline (bool $value) | |
isInline () | |
setCanWrap (bool $value) | |
canWrap () | |
getText () | |
Returns unit text unmodified. | |
getTextWithVariables () | |
Returns the text with tvars replaces with placeholders. | |
getTextForTrans () | |
Returns unit text with variables replaced. | |
getMarkedText () | |
Returns the unit text with updated or added unit marker. | |
getOldText () | |
Returns oldtext, or current text if not available. | |
getVariables () | |
serializeToArray () | |
Serialize this object to a PHP array. | |
getTextForRendering (?TMessage $msg, Language $sourceLanguage, Language $targetLanguage, bool $wrapUntranslated) | |
getIssues () | |
Static Public Member Functions | |
static | unserializeFromArray (array $data) |
Public Attributes | |
const | UNIT_MARKER_INVALID_CHARS = "_/\n<>" |
const | NEW_UNIT_ID = '-1' |
const | TVAR_OLD_SYNTAX_REGEX = '~<tvar\|([^>]+)>(.*?)</>~us' |
const | TVAR_NEW_SYNTAX_REGEX = |
$id | |
$text | |
$type | |
$oldText = null | |
Protected Attributes | |
$inline = false | |
This class represents one translation unit in a translatable page.
Definition at line 18 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::__construct | ( | string | $text, |
string | $id = self::NEW_UNIT_ID, | ||
string | $type = 'new', | ||
string | $oldText = null ) |
Definition at line 52 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::canWrap | ( | ) |
Definition at line 76 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getIssues | ( | ) |
Definition at line 227 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getMarkedText | ( | ) |
Returns the unit text with updated or added unit marker.
Definition at line 106 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getOldText | ( | ) |
Returns oldtext, or current text if not available.
Definition at line 127 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getText | ( | ) |
Returns unit text unmodified.
Definition at line 81 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getTextForRendering | ( | ?TMessage | $msg, |
Language | $sourceLanguage, | ||
Language | $targetLanguage, | ||
bool | $wrapUntranslated ) |
Definition at line 177 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getTextForTrans | ( | ) |
Returns unit text with variables replaced.
Definition at line 96 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getTextWithVariables | ( | ) |
Returns the text with tvars replaces with placeholders.
Definition at line 86 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::getVariables | ( | ) |
Definition at line 132 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::isInline | ( | ) |
Definition at line 68 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::serializeToArray | ( | ) |
Serialize this object to a PHP array.
Definition at line 156 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::setCanWrap | ( | bool | $value | ) |
Definition at line 72 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::setIsInline | ( | bool | $value | ) |
Definition at line 64 of file TranslationUnit.php.
|
static |
Definition at line 167 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::$id |
Definition at line 33 of file TranslationUnit.php.
|
protected |
Definition at line 44 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::$oldText = null |
Definition at line 39 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::$text |
Definition at line 35 of file TranslationUnit.php.
MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::$type |
Definition at line 37 of file TranslationUnit.php.
const MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::NEW_UNIT_ID = '-1' |
Definition at line 20 of file TranslationUnit.php.
const MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::TVAR_NEW_SYNTAX_REGEX = |
Definition at line 24 of file TranslationUnit.php.
const MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::TVAR_OLD_SYNTAX_REGEX = '~<tvar\|([^>]+)>(.*?)</>~us' |
Definition at line 22 of file TranslationUnit.php.
const MediaWiki\Extension\Translate\PageTranslation\TranslationUnit::UNIT_MARKER_INVALID_CHARS = "_/\n<>" |
Definition at line 19 of file TranslationUnit.php.