Index: trunk/phase3/includes/Linker.php |
— | — | @@ -1060,34 +1060,66 @@ |
1061 | 1061 | . "</script>\n"; |
1062 | 1062 | } |
1063 | 1063 | |
1064 | | - /** @todo document */ |
| 1064 | + /** |
| 1065 | + * Used to generate section edit links that point to "other" pages |
| 1066 | + * (sections that are really part of included pages). |
| 1067 | + * |
| 1068 | + * @param $title Title string. |
| 1069 | + * @param $section Integer: section number. |
| 1070 | + */ |
1065 | 1071 | public function editSectionLinkForOther( $title, $section ) { |
1066 | | - global $wgContLang; |
1067 | 1072 | $title = Title::newFromText( $title ); |
1068 | | - $editurl = '§ion='.$section; |
1069 | | - $url = $this->makeKnownLinkObj( $title, wfMsg('editsection'), 'action=edit'.$editurl ); |
1070 | | - $result = null; |
1071 | | - wfRunHooks( 'EditSectionLinkForOther', array( &$this, $title, $section, $url, &$result ) ); |
1072 | | - return is_null( $result ) |
1073 | | - ? "<span class=\"editsection\">[{$url}]</span>" |
1074 | | - : "<span class=\"editsection\">[{$result}]</span>"; |
| 1073 | + return $this->doEditSectionLink( $title, $section, '', 'EditSectionLinkForOther' ); |
1075 | 1074 | } |
1076 | 1075 | |
1077 | 1076 | /** |
1078 | | - * @param $title Title object. |
| 1077 | + * @param $nt Title object. |
1079 | 1078 | * @param $section Integer: section number. |
1080 | 1079 | * @param $hint Link String: title, or default if omitted or empty |
1081 | 1080 | */ |
1082 | | - public function editSectionLink( $nt, $section, $hint='' ) { |
| 1081 | + public function editSectionLink( Title $nt, $section, $hint='' ) { |
| 1082 | + if( $hint != '' ) { |
| 1083 | + $hint = wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ); |
| 1084 | + $hint = " title=\"$hint\""; |
| 1085 | + } |
| 1086 | + return $this->doEditSectionLink( $nt, $section, $hint, 'EditSectionLink' ); |
| 1087 | + } |
| 1088 | + |
| 1089 | + /** |
| 1090 | + * Implement editSectionLink and editSectionLinkForOther. |
| 1091 | + * |
| 1092 | + * @param $nt Title object |
| 1093 | + * @param $section Integer, section number |
| 1094 | + * @param $hint String, for HTML title attribute |
| 1095 | + * @param $hook String, name of hook to run |
| 1096 | + * @return String, HTML to use for edit link |
| 1097 | + */ |
| 1098 | + private function doEditSectionLink( Title $nt, $section, $hint, $hook ) { |
1083 | 1099 | global $wgContLang; |
1084 | 1100 | $editurl = '§ion='.$section; |
1085 | | - $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"'; |
1086 | | - $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint ); |
| 1101 | + $url = $this->makeKnownLinkObj( |
| 1102 | + $nt, |
| 1103 | + wfMsg('editsection'), |
| 1104 | + 'action=edit'.$editurl, |
| 1105 | + '', '', '', $hint |
| 1106 | + ); |
1087 | 1107 | $result = null; |
1088 | | - wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $hint, $url, &$result ) ); |
1089 | | - return is_null( $result ) |
1090 | | - ? "<span class=\"editsection\">[{$url}]</span>" |
1091 | | - : "<span class=\"editsection\">[{$result}]</span>"; |
| 1108 | + |
| 1109 | + // The two hooks have slightly different interfaces . . . |
| 1110 | + if( $hook == 'EditSectionLink' ) { |
| 1111 | + wfRunHooks( $hook, array( &$this, $nt, $section, $hint, $url, &$result ) ); |
| 1112 | + } elseif( $hook == 'EditSectionLinkForOther' ) { |
| 1113 | + wfRunHooks( $hook, array( &$this, $nt, $section, $url, &$result ) ); |
| 1114 | + } |
| 1115 | + |
| 1116 | + // For reverse compatibility, add the brackets *after* the hook is run, |
| 1117 | + // and even add them to hook-provided text. |
| 1118 | + if( is_null( $result ) ) { |
| 1119 | + $result = wfMsg( 'editsection-brackets', $url ); |
| 1120 | + } else { |
| 1121 | + $result = wfMsg( 'editsection-brackets', $result ); |
| 1122 | + } |
| 1123 | + return "<span class=\"editsection\">$result</span>"; |
1092 | 1124 | } |
1093 | 1125 | |
1094 | 1126 | /** |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -682,29 +682,30 @@ |
683 | 683 | 'versionrequired' => 'Version $1 of MediaWiki required', |
684 | 684 | 'versionrequiredtext' => 'Version $1 of MediaWiki is required to use this page. See [[Special:Version|version page]].', |
685 | 685 | |
686 | | -'ok' => 'OK', |
687 | | -'sitetitle' => '{{SITENAME}}', # don't translate or duplicate this message to other languages |
688 | | -'pagetitle' => '$1 - {{SITENAME}}', |
689 | | -'sitesubtitle' => '', # don't translate or duplicate this message to other languages |
690 | | -'retrievedfrom' => 'Retrieved from "$1"', |
691 | | -'youhavenewmessages' => 'You have $1 ($2).', |
692 | | -'newmessageslink' => 'new messages', |
693 | | -'newmessagesdifflink' => 'last change', |
694 | | -'editsection' => 'edit', |
695 | | -'editold' => 'edit', |
696 | | -'editsectionhint' => 'Edit section: $1', |
697 | | -'toc' => 'Contents', |
698 | | -'showtoc' => 'show', |
699 | | -'hidetoc' => 'hide', |
700 | | -'thisisdeleted' => 'View or restore $1?', |
701 | | -'viewdeleted' => 'View $1?', |
702 | | -'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}', |
703 | | -'feedlinks' => 'Feed:', |
704 | | -'feed-invalid' => 'Invalid subscription feed type.', |
705 | | -'feed-atom' => 'Atom', # only translate this message to other languages if you have to change it |
706 | | -'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it |
707 | | -'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages |
708 | | -'anonnotice' => '-', # don't translate or duplicate this message to other languages |
| 686 | +'ok' => 'OK', |
| 687 | +'sitetitle' => '{{SITENAME}}', # don't translate or duplicate this message to other languages |
| 688 | +'pagetitle' => '$1 - {{SITENAME}}', |
| 689 | +'sitesubtitle' => '', # don't translate or duplicate this message to other languages |
| 690 | +'retrievedfrom' => 'Retrieved from "$1"', |
| 691 | +'youhavenewmessages' => 'You have $1 ($2).', |
| 692 | +'newmessageslink' => 'new messages', |
| 693 | +'newmessagesdifflink' => 'last change', |
| 694 | +'editsection' => 'edit', |
| 695 | +'editsection-brackets' => '[$1]', # only translate this message to other languages if you have to change it |
| 696 | +'editold' => 'edit', |
| 697 | +'editsectionhint' => 'Edit section: $1', |
| 698 | +'toc' => 'Contents', |
| 699 | +'showtoc' => 'show', |
| 700 | +'hidetoc' => 'hide', |
| 701 | +'thisisdeleted' => 'View or restore $1?', |
| 702 | +'viewdeleted' => 'View $1?', |
| 703 | +'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}', |
| 704 | +'feedlinks' => 'Feed:', |
| 705 | +'feed-invalid' => 'Invalid subscription feed type.', |
| 706 | +'feed-atom' => 'Atom', # only translate this message to other languages if you have to change it |
| 707 | +'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it |
| 708 | +'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages |
| 709 | +'anonnotice' => '-', # don't translate or duplicate this message to other languages |
709 | 710 | |
710 | 711 | # Short words for each namespace, by default used in the 'article' tab in monobook |
711 | 712 | 'nstab-main' => 'Article', |
— | — | @@ -1266,18 +1267,18 @@ |
1267 | 1268 | 'files' => 'Files', |
1268 | 1269 | |
1269 | 1270 | # User rights |
1270 | | -'userrights-lookup-user' => 'Manage user groups', |
1271 | | -'userrights-user-editname' => 'Enter a username:', |
1272 | | -'editusergroup' => 'Edit User Groups', |
1273 | | -'userrights-editusergroup' => 'Edit user groups', |
1274 | | -'saveusergroups' => 'Save User Groups', |
1275 | | -'userrights-groupsmember' => 'Member of:', |
1276 | | -'userrights-groupsavailable' => 'Available groups:', |
1277 | | -'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to. |
| 1271 | +'userrights-lookup-user' => 'Manage user groups', |
| 1272 | +'userrights-user-editname' => 'Enter a username:', |
| 1273 | +'editusergroup' => 'Edit User Groups', |
| 1274 | +'userrights-editusergroup' => 'Edit user groups', |
| 1275 | +'saveusergroups' => 'Save User Groups', |
| 1276 | +'userrights-groupsmember' => 'Member of:', |
| 1277 | +'userrights-groupsavailable' => 'Available groups:', |
| 1278 | +'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to. |
1278 | 1279 | Unselected groups will not be changed. You can deselect a group with CTRL + Left Click', |
1279 | | -'userrights-reason' => 'Reason for change:', |
1280 | | -'userrights-available-none' => 'You may not alter group membership.', |
1281 | | -'userrights-available-add' => 'You can add users to $1.', |
| 1280 | +'userrights-reason' => 'Reason for change:', |
| 1281 | +'userrights-available-none' => 'You may not alter group membership.', |
| 1282 | +'userrights-available-add' => 'You can add users to $1.', |
1282 | 1283 | 'userrights-available-remove' => 'You can remove users from $1.', |
1283 | 1284 | |
1284 | 1285 | # Groups |
Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -248,6 +248,7 @@ |
249 | 249 | 'newmessageslink', |
250 | 250 | 'newmessagesdifflink', |
251 | 251 | 'editsection', |
| 252 | + 'editsection-brackets', |
252 | 253 | 'editold', |
253 | 254 | 'editsectionhint', |
254 | 255 | 'toc', |
Index: trunk/phase3/maintenance/language/messageTypes.inc |
— | — | @@ -106,6 +106,7 @@ |
107 | 107 | $wgOptionalMessages = array( |
108 | 108 | 'imgmultigotopost', |
109 | 109 | 'linkprefix', |
| 110 | + 'editsection-brackets', |
110 | 111 | 'feed-atom', |
111 | 112 | 'feed-rss', |
112 | 113 | 'sectionlink', |
Index: trunk/phase3/maintenance/language/writeMessagesArray.inc |
— | — | @@ -29,13 +29,12 @@ |
30 | 30 | $contents = file_get_contents( $filename ); |
31 | 31 | if ( strpos( $contents, '$messages' ) !== false ) { |
32 | 32 | $contents = explode( '$messages', $contents ); |
33 | | - if ( $messagesText . "\n?>\n" == '$messages' . $contents[1] ) { |
34 | | - echo "Generated messages for language $code. Same to the current file.\n"; |
| 33 | + if ( $messagesText == '$messages' . $contents[1] ) { |
| 34 | + echo "Generated messages for language $code. Same as the current file.\n"; |
35 | 35 | } else { |
36 | 36 | if ( $write ) { |
37 | 37 | $new = $contents[0]; |
38 | 38 | $new .= $messagesText; |
39 | | - $new .= "\n?>\n"; |
40 | 39 | file_put_contents( $filename, $new ); |
41 | 40 | echo "Generated and wrote messages for language $code.\n"; |
42 | 41 | } else { |