r89722 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89721‎ | r89722 | r89723 >
Date:06:56, 8 June 2011
Author:nagelp
Status:ok
Tags:
Comment:
Prefixed all i18n messages with the extension name; Added message documentation (qqq)
Modified paths:
  • /trunk/extensions/Notificator/Notificator.body.php (modified) (history)
  • /trunk/extensions/Notificator/Notificator.i18n.php (modified) (history)
  • /trunk/extensions/Notificator/SpecialNotificator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Notificator/Notificator.body.php
@@ -31,7 +31,7 @@
3232 <input type="hidden" name="revId" value="' . $wgTitle->getLatestRevID() . '" />
3333 <input type="hidden" name="receiver" value="' . $receiver . '" />
3434 <input type="submit" value="' .
35 -wfMsg( 'notify-address-or-name', htmlspecialchars( $receiverLabel ) ) . '" />
 35+wfMsg( 'notificator-notify-address-or-name', htmlspecialchars( $receiverLabel ) ) . '" />
3636 </form>';
3737 } else {
3838 // No valid e-mail address available, show text entry field and button
@@ -39,10 +39,10 @@
4040 '/Special:Notificator" method="post" enctype="multipart/form-data">
4141 <input type="hidden" name="pageId" value="' . $wgTitle->getArticleID() . '" />
4242 <input type="hidden" name="revId" value="' . $wgTitle->getLatestRevID() . '" />
43 -<input type="text" name="receiver" value="' . wfMsg( 'e-mail-address' ) .
44 -'" onfocus="if (this.value == \'' . wfMsg( 'e-mail-address' ) .
 43+<input type="text" name="receiver" value="' . wfMsg( 'notificator-e-mail-address' ) .
 44+'" onfocus="if (this.value == \'' . wfMsg( 'notificator-e-mail-address' ) .
4545 '\') {this.value=\'\'}" />
46 -<input type="submit" value="' . wfMsg( 'notify' ) . '" />
 46+<input type="submit" value="' . wfMsg( 'notificator-notify' ) . '" />
4747 </form>';
4848 }
4949
@@ -156,7 +156,7 @@
157157
158158 if ( $oldRevisionObj->getTitle() != $newRevisionObj->getTitle() ) {
159159 return '<span class="error">' .
160 - wfMsg( 'revs-not-from-same-title' ) . '</span>';
 160+ wfMsg( 'notificator-revs-not-from-same-title' ) . '</span>';
161161 }
162162
163163 $titleObj = $oldRevisionObj->getTitle();
@@ -219,7 +219,7 @@
220220
221221 public static function getReturnToText( $linkToPage, $pageTitle ) {
222222 return '<p style="margin-top: 2em;">' .
223 - wfMsg( 'return-to' ) . ' <a href="' . $linkToPage . '">' . $pageTitle . '</a>.';
 223+ wfMsg( 'notificator-return-to' ) . ' <a href="' . $linkToPage . '">' . $pageTitle . '</a>.';
224224 }
225225
226226 }
Index: trunk/extensions/Notificator/Notificator.i18n.php
@@ -7,48 +7,71 @@
88 'Notificator' => array( 'Notificator' ),
99 );
1010
 11+$messages['qqq'] = array(
 12+ 'notificator' => 'Name',
 13+ 'notificator-description' => 'Description',
 14+ 'notificator-db-table-does-not-exist' => 'Error message',
 15+ 'notificator-e-mail-address' => 'Hint in text entry field',
 16+ 'notificator-notify' => 'Button label',
 17+ 'notificator-notify-address-or-name' => 'Button label',
 18+ 'notificator-revs-not-from-same-title' => 'Error message (unlikely to show up)',
 19+ 'notificator-return-to' => 'Link at the bottom of the special page',
 20+ 'notificator-special-page-accessed-directly' => 'Error message',
 21+ 'notificator-e-mail-address-invalid' => 'Error message',
 22+ 'notificator-notification-not-sent' => 'Message on special page',
 23+ 'notificator-change-tag' => 'Tag that goes into the e-mail subject (should be as short as possible)',
 24+ 'notificator-new-tag' => 'Tag that goes into the e-mail subject (should be as short as possible)',
 25+ 'notificator-notification-text-changes' => 'Message on special page',
 26+ 'notificator-notification-text-new' => 'Message on special page',
 27+ 'notificator-following-e-mail-sent-to' => 'Message on special page',
 28+ 'notificator-subject' => 'Clarifies that the following text is an e-mail subject',
 29+ 'notificator-error-sending-e-mail' => 'Error message',
 30+ 'notificator-error-parameter-missing' => 'Error message (unlikely to show up)',
 31+ 'notificator-notified-already' => 'Message on special page',
 32+);
 33+
1134 $messages['en'] = array(
1235 'notificator' => 'Notificator',
1336 'notificator-description' => 'Notifies someone by e-mail about changes to a page when a button on that page gets clicked.',
1437 'notificator-db-table-does-not-exist' => 'Database table \'notificator\' does not exist. The update.php maintenance script needs to be run before the Notificator extension can be used.',
15 - 'e-mail-address' => 'e-mail address',
16 - 'notify' => 'Notify', // Button label
17 - 'notify-address-or-name' => 'Notify $1', // Button label
18 - 'revs-not-from-same-title' => 'Revision IDs are not from the same title/article', // Unlikely to be seen by the user
19 - 'return-to' => 'Return to', // Return to <link> - at the bottom of the special page
20 - 'special-page-accessed-directly' => 'This special page cannot be accessed directly. It is intended to be used through a Notificator button.',
21 - 'e-mail-address-invalid' => 'The provided e-mail address is invalid.',
22 - 'notification-not-sent' => 'Notification <em>not</em> sent.',
23 - 'change-tag' => 'change',
24 - 'new-tag' => 'new',
25 - 'notification-text-changes' => '$1 wants to notify you about the following changes to $2:',
26 - 'notification-text-new' => '$1 wants to notify you about $2.',
27 - 'following-e-mail-sent-to' => 'The following e-mail has been sent to <em>$1</em>:',
28 - 'subject' => 'Subject:', // The subject line of an e-mail
29 - 'error-sending-e-mail' => 'There was an error when sending the notification e-mail to <em>$1</em>.',
30 - 'error-parameter-missing' => 'Error: Missing parameter.', // Unlikely to be seen by the user
31 - 'notified-already' => '$1 has been notified about this page or page change before.',
 38+ 'notificator-e-mail-address' => 'e-mail address',
 39+ 'notificator-notify' => 'Notify',
 40+ 'notificator-notify-address-or-name' => 'Notify $1',
 41+ 'notificator-revs-not-from-same-title' => 'Revision IDs are not from the same title/article',
 42+ 'notificator-return-to' => 'Return to',
 43+ 'notificator-special-page-accessed-directly' => 'This special page cannot be accessed directly. It is intended to be used through a Notificator button.',
 44+ 'notificator-e-mail-address-invalid' => 'The provided e-mail address is invalid.',
 45+ 'notificator-notification-not-sent' => 'Notification <em>not</em> sent.',
 46+ 'notificator-change-tag' => 'change',
 47+ 'notificator-new-tag' => 'new',
 48+ 'notificator-notification-text-changes' => '$1 wants to notify you about the following changes to $2:',
 49+ 'notificator-notification-text-new' => '$1 wants to notify you about $2.',
 50+ 'notificator-following-e-mail-sent-to' => 'The following e-mail has been sent to <em>$1</em>:',
 51+ 'notificator-subject' => 'Subject:',
 52+ 'notificator-error-sending-e-mail' => 'There was an error when sending the notification e-mail to <em>$1</em>.',
 53+ 'notificator-error-parameter-missing' => 'Error: Missing parameter.',
 54+ 'notificator-notified-already' => '$1 has been notified about this page or page change before.',
3255 );
3356
3457 $messages['de'] = array(
3558 'notificator' => 'Notificator',
3659 'notificator-description' => 'Sendet Benachrichtungs-Mails über Seitenänderungen, wenn ein Knopf auf der entsprechenden Seite betätigt wird.',
3760 'notificator-db-table-does-not-exist' => 'Datenbanktabelle \'notificator\' existiert nicht. Das update.php Maintenance Script muss ausgeführt werden, bevor die Notificator-Extension verwendet werden kann.',
38 - 'e-mail-address' => 'E-Mail-Adresse',
39 - 'notify' => 'Benachrichtigen',
40 - 'notify-address-or-name' => '$1 benachrichtigen',
41 - 'revs-not-from-same-title' => 'Revision-IDs gehören nicht zum selben Titel/Artikel',
42 - 'return-to' => 'Zurück zu',
43 - 'special-page-accessed-directly' => 'Auf diese Spezial-Seite kann nicht direkt zugegriffen werden. Sie sollte über einen Notificator-Knopf verwendet werden.',
44 - 'e-mail-address-invalid' => 'Die angegebene E-Mail-Adresse ist ungültig.',
45 - 'notification-not-sent' => 'Benachrichtigung <em>nicht</em> gesendet.',
46 - 'change-tag' => 'Änderung',
47 - 'new-tag' => 'Neu',
48 - 'notification-text-changes' => '$1 möchte Sie zu folgenden Änderungen an $2 benachrichtigen:',
49 - 'notification-text-new' => '$1 möchte Sie zu $2 benachrichtigen.',
50 - 'following-e-mail-sent-to' => 'Folgende E-Mail wurde an <em>$1</em> gesendet:',
51 - 'subject' => 'Betreff:',
52 - 'error-sending-e-mail' => 'Beim Versenden der Benachrichtigungs-Mail an <em>$1</em> ist ein Fehler aufgetreten.',
53 - 'error-parameter-missing' => 'Fehler: Fehlender Parameter.',
54 - 'notified-already' => '$1 wurde bereits zu dieser Seite oder Seitenänderung benachrichtigt.',
 61+ 'notificator-e-mail-address' => 'E-Mail-Adresse',
 62+ 'notificator-notify' => 'Benachrichtigen',
 63+ 'notificator-notify-address-or-name' => '$1 benachrichtigen',
 64+ 'notificator-revs-not-from-same-title' => 'Revision-IDs gehören nicht zum selben Titel/Artikel',
 65+ 'notificator-return-to' => 'Zurück zu',
 66+ 'notificator-special-page-accessed-directly' => 'Auf diese Spezial-Seite kann nicht direkt zugegriffen werden. Sie sollte über einen Notificator-Knopf verwendet werden.',
 67+ 'notificator-e-mail-address-invalid' => 'Die angegebene E-Mail-Adresse ist ungültig.',
 68+ 'notificator-notification-not-sent' => 'Benachrichtigung <em>nicht</em> gesendet.',
 69+ 'notificator-change-tag' => 'Änderung',
 70+ 'notificator-new-tag' => 'Neu',
 71+ 'notificator-notification-text-changes' => '$1 möchte Sie zu folgenden Änderungen an $2 benachrichtigen:',
 72+ 'notificator-notification-text-new' => '$1 möchte Sie zu $2 benachrichtigen.',
 73+ 'notificator-following-e-mail-sent-to' => 'Folgende E-Mail wurde an <em>$1</em> gesendet:',
 74+ 'notificator-subject' => 'Betreff:',
 75+ 'notificator-error-sending-e-mail' => 'Beim Versenden der Benachrichtigungs-Mail an <em>$1</em> ist ein Fehler aufgetreten.',
 76+ 'notificator-error-parameter-missing' => 'Fehler: Fehlender Parameter.',
 77+ 'notificator-notified-already' => '$1 wurde bereits zu dieser Seite oder Seitenänderung benachrichtigt.',
5578 );
\ No newline at end of file
Index: trunk/extensions/Notificator/SpecialNotificator.php
@@ -22,15 +22,15 @@
2323 $receiver = $wgRequest->getText( 'receiver' );
2424
2525 if ( ! $pageId || ! $revId || ! $receiver ) {
26 - $output = '<span class="error">' . wfMsg( 'special-page-accessed-directly' ) . '</span>';
 26+ $output = '<span class="error">' . wfMsg( 'notificator-special-page-accessed-directly' ) . '</span>';
2727 } else {
2828 $titleObj = Title::newFromID( $pageId );
2929 $pageTitle = $titleObj->getFullText();
3030 $linkToPage = $titleObj->getFullURL();
3131
3232 if ( ! Notificator::checkEmailAddress( $receiver ) ) {
33 - $output = '<span class="error">' . wfMsg( 'e-mail-address-invalid' ) . ' ' .
34 - wfMsg( 'notification-not-sent' ) . '</span>';
 33+ $output = '<span class="error">' . wfMsg( 'notificator-e-mail-address-invalid' ) . ' ' .
 34+ wfMsg( 'notificator-notification-not-sent' ) . '</span>';
3535 $output .= Notificator::getReturnToText( $linkToPage, $pageTitle );
3636 $wgOut->addHTML( $output );
3737 return;
@@ -41,37 +41,37 @@
4242 if ( $oldRevId >= 0 ) {
4343 if ( $oldRevId > 0 ) {
4444 // Receiver has been notified before - send the diff to the last notified revision
45 - $mailSubjectPrefix = '[' . wfMsg( 'change-tag' ) . '] ';
 45+ $mailSubjectPrefix = '[' . wfMsg( 'notificator-change-tag' ) . '] ';
4646
4747 $wgOut->addModules( 'mediawiki.legacy.diff' );
4848 $diff = Notificator::getNotificationDiffHtml( $oldRevId, $revId );
49 - $notificationText = wfMsg( 'notification-text-changes',
 49+ $notificationText = wfMsg( 'notificator-notification-text-changes',
5050 htmlspecialchars( $wgUser->getName() ), '<a href="' . $linkToPage . '">' .
5151 $pageTitle . '</a>' ) . '<div style="margin-top: 1em;">' . $diff . '</div>';
5252 } else {
5353 // Receiver has never been notified about this page - so don't send a diff, just the link
54 - $mailSubjectPrefix = '[' . wfMsg( 'new-tag' ) . '] ';
55 - $notificationText = wfMsg( 'notification-text-new',
 54+ $mailSubjectPrefix = '[' . wfMsg( 'notificator-new-tag' ) . '] ';
 55+ $notificationText = wfMsg( 'notificator-notification-text-new',
5656 htmlspecialchars( $wgUser->getName() ), '<a href="' . $linkToPage . '">' .
5757 $pageTitle . '</a>' );
5858 }
5959 $mailSubject = htmlspecialchars( $mailSubjectPrefix . $pageTitle );
6060
6161 if ( Notificator::sendNotificationMail( $receiver, $mailSubject, $notificationText ) ) {
62 - $output = '<strong>' . wfMsg( 'following-e-mail-sent-to',
 62+ $output = '<strong>' . wfMsg( 'notificator-following-e-mail-sent-to',
6363 htmlspecialchars( $receiver ) ) . '</strong><div style="margin-top: 1em;"><h3>' .
64 - wfMsg( 'subject' ) . ' ' . $mailSubject . '</h3><p>' . $notificationText .
 64+ wfMsg( 'notificator-subject' ) . ' ' . $mailSubject . '</h3><p>' . $notificationText .
6565 '</p></div>';
6666 Notificator::recordNotificationInDatabase( $pageId, $revId, $receiver );
6767 } else {
68 - $output = '<span class="error">' . wfMsg( 'error-sending-e-mail',
 68+ $output = '<span class="error">' . wfMsg( 'notificator-error-sending-e-mail',
6969 htmlspecialchars( $receiver ) ) . '</span>';
7070 }
7171 } elseif ( $oldRevId == -1 ) {
72 - $output = '<span class="error">' . wfMsg( 'error-parameter-missing' ) . '</span>';
 72+ $output = '<span class="error">' . wfMsg( 'notificator-error-parameter-missing' ) . '</span>';
7373 } elseif ( $oldRevId == -2 ) {
74 - $output = '<strong>' . wfMsg( 'notified-already', htmlspecialchars( $receiver ) ) .
75 - ' ' . wfMsg( 'notification-not-sent' ) . '</strong>';
 74+ $output = '<strong>' . wfMsg( 'notificator-notified-already', htmlspecialchars( $receiver ) ) .
 75+ ' ' . wfMsg( 'notificator-notification-not-sent' ) . '</strong>';
7676 }
7777
7878 $output .= Notificator::getReturnToText( $linkToPage, $pageTitle );

Status & tagging log