aboutsummaryrefslogtreecommitdiffstats
path: root/includes/diff/TextSlotDiffRenderer.php
diff options
context:
space:
mode:
authorTim Starling <tstarling@wikimedia.org>2023-07-20 09:58:59 +1000
committerTim Starling <tstarling@wikimedia.org>2023-07-20 10:09:42 +1000
commit4014f56d73a4795e5ed5d8b159256bf5f5bad6f2 (patch)
treeeb93db808da0f155a8ced5c97d30084b57d70f7a /includes/diff/TextSlotDiffRenderer.php
parent81b928e44f1b8719006851dd53304a6e4ef08039 (diff)
downloadmediawikicore-4014f56d73a4795e5ed5d8b159256bf5f5bad6f2.tar.gz
mediawikicore-4014f56d73a4795e5ed5d8b159256bf5f5bad6f2.zip
Add SlotDiffRenderer::localizeDiff()
It makes sense for SlotDiffRenderer to localize the diffs that it returns. DifferenceEngine can't conveniently use this right now since it stores all slot diffs concatenated together in a cache entry. It can't break the string apart again to call the right SlotDiffRenderer on each slot diff. So it assumes there must be a text diff in there somewhere and calls TextDiffer over the whole thing. EntitySchema does not have this problem and can benefit from this method. Bug: T342209 Change-Id: Ie06e100bb0e945de5dbe3dade14b2e6b706e078d
Diffstat (limited to 'includes/diff/TextSlotDiffRenderer.php')
-rw-r--r--includes/diff/TextSlotDiffRenderer.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/includes/diff/TextSlotDiffRenderer.php b/includes/diff/TextSlotDiffRenderer.php
index c7d5f4403cba..1621d38108de 100644
--- a/includes/diff/TextSlotDiffRenderer.php
+++ b/includes/diff/TextSlotDiffRenderer.php
@@ -220,6 +220,10 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
return $this->getTextDiff( $oldText, $newText );
}
+ public function localizeDiff( $diff, $options = [] ) {
+ return $this->textDiffer->localize( $this->format, $diff, $options );
+ }
+
/**
* @inheritDoc
*/