r25423 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25422‎ | r25423 | r25424 >
Date:08:11, 3 September 2007
Author:erik
Status:old
Tags:
Comment:
add i18n file & i18nize some messages
prettify edit summaries
Modified paths:
  • /branches/liquidthreads/extensions/LqtBaseView.php (modified) (history)
  • /branches/liquidthreads/extensions/LqtI18N.php (added) (history)
  • /branches/liquidthreads/extensions/LqtPages.php (modified) (history)

Diff [purge]

Index: branches/liquidthreads/extensions/LqtI18N.php
@@ -0,0 +1,50 @@
 2+<?php
 3+
 4+/**
 5+* Internationalisation file for Language Manager extension.
 6+*
 7+* @package MediaWiki
 8+* @subpackage LiquidThreads
 9+* @author David McCabe <davemccabe@gmail.com> / I18N file by Erik Moeller
 10+* @licence GPL2
 11+*/
 12+
 13+if( !defined( 'MEDIAWIKI' ) ) {
 14+ echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
 15+ die( -1 );
 16+}
 17+
 18+global $wgExtensionFunctions;
 19+$wgExtensionFunctions[]='wfInitializeLqtMessages';
 20+
 21+function wfInitializeLqtMessages() {
 22+ global $wgMessageCache;
 23+ $lqtMessages = array();
 24+ $lqtMessages['en'] = array(
 25+ 'lqt_browse_archive' => 'Browse archive',
 26+ 'lqt_recently_archived' => 'Recently archived',
 27+ 'lqt_add_header'=>'Add header',
 28+ 'lqt_new_thread'=>'Start a new discussion',
 29+ 'lqt_move_placeholder'=>"''Placeholder left when the thread was moved to another page.''",
 30+ 'lqt_reply'=>'Reply',
 31+ 'lqt_delete'=>'Delete',
 32+ 'lqt_undelete'=>'Undelete',
 33+ 'lqt_permalink'=>'Permalink',
 34+ 'lqt_fragment'=>'a fragment of a $1 from $2',
 35+ 'lqt_discussion_link'=>'discussion', // substituted above
 36+ 'lqt_from_talk'=>'from $1',
 37+ 'lqt_comment_edited'=>'Comment text edited',
 38+ 'lqt_summary_changed'=>'Summary changed',
 39+ 'lqt_reply_created'=>'New reply created',
 40+ 'lqt_thread_created'=>'New thread created',
 41+ 'lqt_deleted'=>'Deleted',
 42+ 'lqt_undeleted'=>'Undeleted',
 43+ 'lqt_history_subtitle'=>'Viewing a history listing.',
 44+ );
 45+
 46+ foreach( $lqtMessages as $key => $value ) {
 47+ $wgMessageCache->addMessages( $lqtMessages[$key], $key );
 48+ }
 49+}
 50+
 51+?>
Property changes on: branches/liquidthreads/extensions/LqtI18N.php
___________________________________________________________________
Added: svn:eol-style
152 + native
Index: branches/liquidthreads/extensions/LqtPages.php
@@ -13,6 +13,7 @@
1414 }
1515
1616 require_once('LqtBaseView.php');
 17+require_once('LqtI18N.php');
1718
1819 class TalkpageView extends LqtView {
1920 /* Added to SkinTemplateTabs hook in TalkpageView::show(). */
@@ -48,17 +49,18 @@
4950 function showArchiveWidget() {
5051 $threads = $this->queries->query('recently-archived');
5152 $threadlinks = $this->permalinksForThreads($threads);
52 -
 53+
5354 if ( count($threadlinks) > 0 ) {
5455 $this->openDiv('lqt_archive_teaser');
55 - $this->output->addHTML('Recently archived:');
 56+ $this->output->addHTML(wfMsg('lqt_recently_archived'));
5657 $this->outputList('ul', '', '', $threadlinks);
5758 } else {
5859 $this->openDiv();
5960 }
6061 $url = $this->talkpageUrl($this->title, 'talkpage_archive');
 62+ $browse=wfMsg('lqt_browse_archive');
6163 $this->output->addHTML(<<<HTML
62 - <p><a href="$url" class="lqt_browse_archive">Browse the Archive</a></p>
 64+ <p><a href="$url" class="lqt_browse_archive">$browse</a></p>
6365 HTML
6466 );
6567 $this->closeDiv();
@@ -72,21 +74,22 @@
7375
7476 function showHeader() {
7577 /* Show the contents of the actual talkpage article if it exists. */
 78+
7679 $article = new Article( $this->title );
7780 $oldid = $this->request->getVal('oldid', null);
 81+ $editlink = $this->title->getFullURL( 'action=edit' );
7882
7983 if ( $article->exists() ) {
80 - $edit = $this->title->getFullURL( 'action=edit' );
81 - $history = $this->title->getFullURL( 'action=history' );
 84+ $historylink = $this->title->getFullURL( 'action=history' );
8285 $this->openDiv('lqt_header_content');
8386 $this->showPostBody($article, $oldid);
8487 $this->outputList('ul', 'lqt_header_commands', null, array(
85 - "[<a href=\"$edit\">edit</a>]",
86 - "[<a href=\"$history\">history</a>]"
 88+ "[<a href=\"$editlink\">".wfMsg('edit')."</a>]",
 89+ "[<a href=\"$historylink\">".wfMsg('history_short')."</a>]"
8790 ));
8891 $this->closeDiv();
8992 } else {
90 - $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"{$this->title->getFullURL('action=edit')}\">add header</a>]</p>");
 93+ $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"$editlink\">".wfMsg('lqt_add_header')."</a>]</p>");
9194 }
9295 }
9396
@@ -103,7 +106,7 @@
104107 function show() {
105108 global $wgHooks;
106109 $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
107 -
 110+
108111 $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
109112 $this->addJSandCSS();
110113
@@ -117,7 +120,7 @@
118121 $this->showNewThreadForm();
119122 } else {
120123 $url = $this->talkpageUrl( $this->title, 'talkpage_new_thread' );
121 - $this->output->addHTML("<strong><a class=\"lqt_start_discussion\" href=\"$url\">Start&nbsp;a&nbsp;Discussion</a></strong>");
 124+ $this->output->addHTML("<strong><a class=\"lqt_start_discussion\" href=\"$url\">".wfMsg('lqt_new_thread')."</a></strong>");
122125 }
123126
124127 $threads = $this->queries->query('fresh');
@@ -143,7 +146,7 @@
144147 ); if( $t->hasSummary() ) {
145148 $this->showPostBody($t->summary());
146149 } else if ( $t->type() == Threads::TYPE_MOVED ) {
147 - $this->output->addHTML("<i>Placeholder left when the thread was moved to another page.</i>");
 150+ $this->output->addWikiText(wfMsg('lqt_move_placeholder'));
148151 }
149152 $this->output->addHTML(<<<HTML
150153 </td>
@@ -432,9 +435,10 @@
433436 $talkpage_link = $this->user->getSkin()->makeKnownLinkObj($talkpage, '', $query);
434437
435438 if ( $this->thread->hasSuperthread() ) {
436 - $this->output->setSubtitle( "a fragment of <a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">a discussion</a> from " . $talkpage_link );
 439+ $subtitle=wfMsg('lqt_fragment',"<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">".wfMsg('lqt_discussion_link')."</a>",$talkpage_link);
 440+ $this->output->setSubtitle( $subtitle);
437441 } else {
438 - $this->output->setSubtitle( "from " . $talkpage_link );
 442+ $this->output->setSubtitle( wfMsg('lqt_from_talk', $talkpage_link));
439443 }
440444
441445 if( $this->methodApplies('summarize') )
@@ -526,12 +530,12 @@
527531 /* TODO: best not to refer to LqtView class directly. */
528532 /* We don't use oldid because that has side-effects. */
529533 $result = array();
530 - $change_names = array(Threads::CHANGE_EDITED_ROOT => "Comment text edited:",
531 - Threads::CHANGE_EDITED_SUMMARY => "Summary changed:",
532 - Threads::CHANGE_REPLY_CREATED => "New reply created:",
533 - Threads::CHANGE_NEW_THREAD => "New thread created:",
534 - Threads::CHANGE_DELETED => "Deleted:",
535 - Threads::CHANGE_UNDELETED => "Undeleted:");
 534+ $change_names = array( Threads::CHANGE_EDITED_ROOT => wfMsg('lqt_comment_edited'),
 535+ Threads::CHANGE_EDITED_SUMMARY => wfMsg('lqt_summary_changed'),
 536+ Threads::CHANGE_REPLY_CREATED => wfMsg('lqt_reply_created'),
 537+ Threads::CHANGE_NEW_THREAD => wfMsg('lqt_thread_created'),
 538+ Threads::CHANGE_DELETED => wfMsg('lqt_deleted'),
 539+ Threads::CHANGE_UNDELETED => wfMsg('lqt_undeleted'));
536540 $change_label = array_key_exists($t->changeType(), $change_names) ? $change_names[$t->changeType()] : "";
537541
538542 $url = LqtView::permalinkUrlWithQuery( $this->thread, 'lqt_oldid=' . $t->revisionNumber() );
@@ -541,11 +545,15 @@
542546 $sig = $this->user->getSkin()->userLink( $user_id, $user_text ) .
543547 $this->user->getSkin()->userToolLinks( $user_id, $user_text );
544548
 549+ $change_comment=$t->changeComment();
 550+ if(!empty($change_comment))
 551+ $change_comment="<em>($change_comment)</em>";
 552+
545553 $result[] = "<tr>";
546554 $result[] = "<td><a href=\"$url\">" . $wgLang->timeanddate($t->timestamp()) . "</a></td>";
547555 $result[] = "<td>" . $sig . "</td>";
548556 $result[] = "<td>$change_label</td>";
549 - $result[] = "<td>" . $t->changeComment() . "</td>";
 557+ $result[] = "<td>$change_comment</td>";
550558 $result[] = "</tr>";
551559 return implode('', $result);
552560 }
@@ -568,7 +576,7 @@
569577 return false;
570578 }
571579
572 - $this->output->setSubtitle("Viewing a history listing.");
 580+ $this->output->setSubtitle(wfMsg('lqt_history_subtitle'));
573581
574582 $this->showThreadHeading($this->thread);
575583 $this->showHistoryListing($this->thread);
@@ -891,4 +899,5 @@
892900 SpecialPage::addPage( new SpecialDeleteThread() );
893901 }
894902
 903+
895904 ?>
Index: branches/liquidthreads/extensions/LqtBaseView.php
@@ -437,20 +437,20 @@
438438
439439 $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' );
440440
441 - $commands[] = array( 'label' => $user_can_edit ? 'Edit' : 'View source',
 441+ $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'),
442442 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
443443 'enabled' => true );
444444
445 - $commands[] = array( 'label' => 'Reply',
 445+ $commands[] = array( 'label' => wfMsg('lqt_reply'),
446446 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
447447 'enabled' => $user_can_edit );
448448
449 - $commands[] = array( 'label' => 'Permalink',
 449+ $commands[] = array( 'label' => wfMsg('lqt_permalink'),
450450 'href' => $this->permalinkUrl( $thread ),
451451 'enabled' => true );
452452
453453 if( !$thread->hasSuperthread() ) {
454 - $commands[] = array( 'label' => 'History',
 454+ $commands[] = array( 'label' => wfMsg('history_short'),
455455 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'),
456456 'enabled' => true );
457457 }
@@ -458,7 +458,7 @@
459459 if ( in_array('delete', $this->user->getRights()) ) {
460460 $delete_url = SpecialPage::getPage('Deletethread')->getTitle()->getFullURL()
461461 . '/' . $thread->title()->getPrefixedURL();
462 - $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? 'Undelete' : 'Delete',
 462+ $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg('lqt_undelete') : wfMsg('delete'),
463463 'href' => $delete_url,
464464 'enabled' => true );
465465 }

Status & tagging log