Followup r70783. Give doEditSectionLink an extra parameter with the language to use for the editsection.

This commit is contained in:
Platonides 2010-08-12 12:30:47 +00:00
parent ed4577377f
commit 69ad72018b
2 changed files with 9 additions and 8 deletions

View file

@ -1375,16 +1375,17 @@ class Linker {
* to be included in the link, like "&section=$section"
* @param $tooltip string The tooltip to use for the link: will be escaped
* and wrapped in the 'editsectionhint' message
* @param $lang string Language code
* @return string HTML to use for edit link
*/
public function doEditSectionLink( Title $nt, $section, $tooltip = null ) {
public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) {
// HTML generated here should probably have userlangattributes
// added to it for LTR text on RTL pages
$attribs = array();
if( !is_null( $tooltip ) ) {
$attribs['title'] = wfMsg( 'editsectionhint', $tooltip );
$attribs['title'] = wfMsgReal( 'editsectionhint', array( $tooltip ), true, $lang );
}
$link = $this->link( $nt, wfMsg('editsection'),
$link = $this->link( $nt, wfMsgExt( 'editsection', array( 'language'=> $lang ) ),
$attribs,
array( 'action' => 'edit', 'section' => $section ),
array( 'noclasses', 'known' )
@ -1394,7 +1395,7 @@ class Linker {
# we can rid of it someday.
$attribs = '';
if( $tooltip ) {
$attribs = wfMsgHtml( 'editsectionhint', htmlspecialchars( $tooltip ) );
$attribs = htmlspecialchars( wfMsgReal( 'editsectionhint', array( $tooltip ), true, $lang ) );
$attribs = " title=\"$attribs\"";
}
$result = null;
@ -1404,13 +1405,13 @@ class Linker {
# run, and even add them to hook-provided text. (This is the main
# reason that the EditSectionLink hook is deprecated in favor of
# DoEditSectionLink: it can't change the brackets or the span.)
$result = wfMsgHtml( 'editsection-brackets', $result );
$result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language'=>$lang ), $link );
return "<span class=\"editsection\">$result</span>";
}
# Add the brackets and the span, and *then* run the nice new hook, with
# clean and non-redundant arguments.
$result = wfMsgHtml( 'editsection-brackets', $link );
$result = wfMsgExt( 'editsection-brackets', array( 'escape', 'replaceafter', 'language'=>$lang ), $link );
$result = "<span class=\"editsection\">$result</span>";
wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result ) );

View file

@ -3967,9 +3967,9 @@ class Parser {
if ( $isTemplate ) {
# Put a T flag in the section identifier, to indicate to extractSections()
# that sections inside <includeonly> should be counted.
$editlink = $sk->doEditSectionLink( Title::newFromText( $titleText ), "T-$sectionIndex" );
$editlink = $sk->doEditSectionLink( Title::newFromText( $titleText ), "T-$sectionIndex", null, $this->mOptions->getUserLang() );
} else {
$editlink = $sk->doEditSectionLink( $this->mTitle, $sectionIndex, $headlineHint );
$editlink = $sk->doEditSectionLink( $this->mTitle, $sectionIndex, $headlineHint, $this->mOptions->getUserLang() );
}
} else {
$editlink = '';