var $mOldid, $mNewid;
var $mOldtitle, $mNewtitle, $mPagetitle;
var $mOldtext, $mNewtext;
+ var $mDiffLang;
/**
* @var Title
}
wfDebug( "DifferenceEngine old '$old' new '$new' rcid '$rcid'\n" );
+ # Default language in which the diff text is written.
+ $this->mDiffLang = $this->mTitle->getPageLanguage();
+
if ( 'prev' === $new ) {
# Show diff between revision $old and the previous one.
# Get previous one from DB.
* @return string
*/
function addHeader( $diff, $otitle, $ntitle, $multi = '', $notice = '' ) {
- // shared.css sets diff in interface language/dir,
- // but the actual content should be in the page language/dir
- $pageLang = $this->mTitle->getPageLanguage();
- $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $pageLang->alignStart() );
+ // shared.css sets diff in interface language/dir, but the actual content
+ // is often in a different language, mostly the page content language/dir
+ $tableClass = 'diff diff-contentalign-' . htmlspecialchars( $this->mDiffLang->alignStart() );
$header = "<table class='$tableClass'>";
if ( $diff ) { // Safari/Chrome show broken output if cols not used
$header .= "
$this->mRevisionsLoaded = true;
}
+ /**
+ * Set the language in which the diff text is written
+ * (Defaults to page content language).
+ * @since 1.19
+ */
+ function setDiffLang( $lang ) {
+ $this->mDiffLang = wfGetLangObj( $lang );
+ }
+
/**
* Load revision metadata for the specified articles. If newid is 0, then compare
* the old article in oldid to the current article; if oldid is 0, then