r74155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74154‎ | r74155 | r74156 >
Date:21:24, 2 October 2010
Author:platonides
Status:ok
Tags:
Comment:
Use full message names everywhere
Modified paths:
  • /trunk/extensions/ArticleComments/ArticleComments.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleComments/ArticleComments.php
@@ -181,7 +181,6 @@
182182 $tmp[strtolower( $k )] = (bool)strcasecmp( $v, "false" );
183183 }
184184 $params = $tmp;
185 - $ac = 'article-comments-';
186185
187186 # Build out the comment form.
188187 $content = '<div id="commentForm">';
@@ -190,21 +189,21 @@
191190 $content .= '<p>';
192191 $content .= Html::hidden( 'commentArticle', $title->getPrefixedDBkey() );
193192
194 - $content .= '<label for="commenterName">' . wfMsgExt( $ac . 'name-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 193+ $content .= '<label for="commenterName">' . wfMsgExt( 'article-comments-name-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
195194 $content .= Html::input( 'commenterName', '', 'text', array( 'id' => 'commenterName' ) );
196195 $content .= '</p>';
197196
198197 if ( $params['showurlfield'] ) {
199 - $content .= '<p><label for="commenterURL">' . wfMsgExt( $ac . 'url-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 198+ $content .= '<p><label for="commenterURL">' . wfMsgExt( 'article-comments-url-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
200199 $content .= Html::input( 'commenterURL', 'http://', 'text', array( 'id' => 'commenterURL' ) );
201200 $content .= '</p>';
202201 }
203202
204 - $content .= '<p><label for="comment">' . wfMsgExt( $ac . 'comment-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
 203+ $content .= '<p><label for="comment">' . wfMsgExt( 'article-comments-comment-field', array( 'parseinline', 'content' ) ) . Html::element( 'br' ) . '</label>';
205204
206205 $content .= '<textarea id="comment" name="comment" style="width:30em" rows="5">' . '</textarea></p>';
207206
208 - $content .= '<p>' . Html::input( 'comment-submit', wfMsgForContent( $ac . 'submit-button' ), 'submit' ) . '</p>';
 207+ $content .= '<p>' . Html::input( 'comment-submit', wfMsgForContent( 'article-comments-submit-button' ), 'submit' ) . '</p>';
209208 $content .= '</form></div>';
210209
211210 # Short-circuit if noScript has been set to anything other than false
@@ -230,7 +229,7 @@
231230 # Note: This is done dynamically with JavaScript since it would be annoying
232231 # for JS-disabled browsers to have the prefilled text (since they'd have
233232 # to manually delete it) and would break parser output caching
234 - $pretext = wfMsgForContent( $ac . 'prefilled-comment-text' );
 233+ $pretext = wfMsgForContent( 'article-comments-prefilled-comment-text' );
235234 if ( $pretext ) {
236235 $content .=
237236 'var comment = document.getElementById("comment");' . "\n" .
@@ -259,7 +258,7 @@
260259 'p.innerHTML="<a href=\'javascript:void(0)\' onclick=\'' .
261260 'document.getElementById(\\"commentForm\\").style.display=\\"block\\";' .
262261 'this.style.display=\\"none\\";false' .
263 - '\'>' . wfMsgForContent( $ac . 'leave-comment-link' ) . '</a>";' . "\n" .
 262+ '\'>' . wfMsgForContent( 'article-comments-leave-comment-link' ) . '</a>";' . "\n" .
264263 'cf.parentNode.insertBefore(p,cf);' . "\n";
265264 }
266265
@@ -304,30 +303,29 @@
305304 $title = Title::newFromText( $titleText );
306305
307306 # Perform validation checks on supplied fields
308 - $ac = 'article-comments-';
309307 $messages = array();
310308
311309 if ( !$wgRequest->wasPosted() )
312 - $messages[] = wfMsgForContent( $ac . 'not-posted' );
 310+ $messages[] = wfMsgForContent( 'article-comments-not-posted' );
313311
314312 if ( $titleText === '' || !$title ) {
315313 $messages[] = wfMsgForContent(
316 - $ac . 'invalid-field', wfMsgForContent( $ac . 'title-string' ), $titleText );
 314+ 'article-comments-invalid-field', wfMsgForContent( 'article-comments-title-string' ), $titleText );
317315 }
318316
319317 if ( !$commenterName ) $messages[] = wfMsgForContent(
320 - $ac . 'required-field', wfMsgForContent( $ac . 'name-string' ) );
 318+ 'article-comments-required-field', wfMsgForContent( 'article-comments-name-string' ) );
321319
322320 if ( !preg_match( "/^(" . wfUrlProtocols() . ')' . Parser::EXT_LINK_URL_CLASS . '+$/', $commenterURL ) )
323321 $messages[] = wfMsgForContent(
324 - $ac . 'invalid-field', wfMsgForContent( $ac . 'url-string' ), $commenterURL );
 322+ 'article-comments-invalid-field', wfMsgForContent( 'article-comments-url-string' ), $commenterURL );
325323
326324 if ( !$comment ) $messages[] = wfMsgForContent(
327 - $ac . 'required-field', wfMsgForContent( $ac . 'comment-string' ) );
 325+ 'article-comments-required-field', wfMsgForContent( 'article-comments-comment-string' ) );
328326 if ( !empty( $messages ) ) {
329 - $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
 327+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
330328 $wikiText = "<div class='errorbox'>";
331 - $wikiText .= wfMsgForContent( $ac . 'failure-reasons' ) . "\n\n";
 329+ $wikiText .= wfMsgForContent( 'article-comments-failure-reasons' ) . "\n\n";
332330 foreach ( $messages as $message ) {
333331 $wikiText .= "* $message\n";
334332 }
@@ -343,10 +341,10 @@
344342
345343 # Check whether user is blocked from editing the talk page
346344 if ( $wgUser->isBlockedFrom( $talkTitle ) ) {
347 - $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
 345+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
348346 $wikiText = "<div class='errorbox'>";
349 - $wikiText .= wfMsgForContent( $ac . 'failure-reasons' ) . "\n\n";
350 - $wikiText .= '* ' . wfMsgForContent( $ac . 'user-is-blocked', $talkTitle->getPrefixedText() ) . "\n";
 347+ $wikiText .= wfMsgForContent( 'article-comments-failure-reasons' ) . "\n\n";
 348+ $wikiText .= '* ' . wfMsgForContent( 'article-comments-user-is-blocked', $talkTitle->getPrefixedText() ) . "\n";
351349 $wgOut->addWikiText( $wikiText . "</div>" );
352350 return;
353351 }
@@ -378,10 +376,10 @@
379377 preg_match( '/<comments( +[^>]*)?\\/>/', $articleContent ) === 0 &&
380378 preg_match( '/<comments( +[^>]*)?\\/>/', $talkContent ) === 0
381379 ) {
382 - $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
 380+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
383381 $wgOut->addWikiText(
384382 "<div class='errorbox'>" .
385 - wfMsgForContent( $ac . 'no-comments', $title->getPrefixedText() ) .
 383+ wfMsgForContent( 'article-comments-no-comments', $title->getPrefixedText() ) .
386384 "</div>"
387385 );
388386 return;
@@ -393,10 +391,10 @@
394392
395393 # If it's spam - it's gone!
396394 if ( $isspam ) {
397 - $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-failed' ) );
 395+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-failed' ) );
398396 $wgOut->addWikiText(
399397 "<div class='errorbox'>" .
400 - wfMsgForContent( $ac . 'no-spam' ) .
 398+ wfMsgForContent( 'article-comments-no-spam' ) .
401399 "</div>"
402400 );
403401 return;
@@ -404,7 +402,7 @@
405403
406404 # Initialize the talk page's content.
407405 if ( $talkContent == '' ) {
408 - $talkContent = wfMsgForContent( $ac . 'talk-page-starter', $title->getPrefixedText() );
 406+ $talkContent = wfMsgForContent( 'article-comments-talk-page-starter', $title->getPrefixedText() );
409407 }
410408
411409 # Determine signature components
@@ -414,8 +412,8 @@
415413
416414 # Search for insertion point, or append most recent comment.
417415 $commentText = wfMsgForContent(
418 - $ac . 'new-comment',
419 - wfMsgForContent( $ac . 'commenter-said', $commenterName ),
 416+ 'article-comments-new-comment',
 417+ wfMsgForContent( 'article-comments-commenter-said', $commenterName ),
420418 $comment,
421419 $sigText,
422420 '~~~~~'
@@ -435,12 +433,12 @@
436434 }
437435
438436 # Update the talkArticle with the new comment
439 - $summary = wfMsgForContent( $ac . 'summary', $commenterName );
 437+ $summary = wfMsgForContent( 'article-comments-summary', $commenterName );
440438 $talkArticle->doEdit( $talkContent, $summary );
441439
442 - $wgOut->setPageTitle( wfMsgForContent( $ac . 'submission-succeeded' ) );
443 - $wgOut->addWikiText( wfMsgForContent( $ac . 'submission-success', $title->getPrefixedText() ) );
444 - $wgOut->addWikiText( wfMsgForContent( $ac . 'submission-view-all', $talkTitle->getPrefixedText() ) );
 440+ $wgOut->setPageTitle( wfMsgForContent( 'article-comments-submission-succeeded' ) );
 441+ $wgOut->addWikiText( wfMsgForContent( 'article-comments-submission-success', $title->getPrefixedText() ) );
 442+ $wgOut->addWikiText( wfMsgForContent( 'article-comments-submission-view-all', $talkTitle->getPrefixedText() ) );
445443 }
446444
447445 /**

Status & tagging log