Index: trunk/phase3/includes/DifferenceEngine.php |
— | — | @@ -326,6 +326,7 @@ |
327 | 327 | $difftext = $wgMemc->get( $key ); |
328 | 328 | if ( $difftext ) { |
329 | 329 | wfIncrStats( 'diff_cache_hit' ); |
| 330 | + $difftext = $this->localiseLineNumbers( $difftext ); |
330 | 331 | $difftext .= "\n<!-- diff cache key $key -->\n"; |
331 | 332 | return $difftext; |
332 | 333 | } |
— | — | @@ -362,10 +363,25 @@ |
363 | 364 | } else { |
364 | 365 | wfIncrStats( 'diff_uncacheable' ); |
365 | 366 | } |
| 367 | + // Replace line numbers with the text in the user's language |
| 368 | + $difftext = $this->localiseLineNumbers( $difftext ); |
366 | 369 | return $difftext; |
367 | 370 | } |
368 | 371 | |
369 | 372 | /** |
| 373 | + * Replace line numbers with the text in the user's language |
| 374 | + */ |
| 375 | + function localiseLineNumbers( $text ) { |
| 376 | + return preg_replace_callback( '/<!--LINE (\d+)-->/', |
| 377 | + array( &$this, 'localiseLineNumbersCb' ), $text ); |
| 378 | + } |
| 379 | + |
| 380 | + function localiseLineNumbersCb( $matches ) { |
| 381 | + global $wgLang; |
| 382 | + return wfMsg( 'lineno', $wgLang->formatNum( $matches[1] ) ); |
| 383 | + } |
| 384 | + |
| 385 | + /** |
370 | 386 | * Add the header to a diff body |
371 | 387 | */ |
372 | 388 | function addHeader( $diff, $otitle, $ntitle ) { |
— | — | @@ -1601,11 +1617,8 @@ |
1602 | 1618 | } |
1603 | 1619 | |
1604 | 1620 | function _block_header( $xbeg, $xlen, $ybeg, $ylen ) { |
1605 | | - $l1 = wfMsg( 'lineno', $xbeg ); |
1606 | | - $l2 = wfMsg( 'lineno', $ybeg ); |
1607 | | - |
1608 | | - $r = '<tr><td colspan="2" align="left"><strong>'.$l1."</strong></td>\n" . |
1609 | | - '<td colspan="2" align="left"><strong>'.$l2."</strong></td></tr>\n"; |
| 1621 | + $r = '<tr><td colspan="2" align="left"><strong><!--LINE '.$xbeg."--></strong></td>\n" . |
| 1622 | + '<td colspan="2" align="left"><strong><!--LINE '.$ybeg."--></strong></td></tr>\n"; |
1610 | 1623 | return $r; |
1611 | 1624 | } |
1612 | 1625 | |