Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1544,6 +1544,8 @@ |
1545 | 1545 | * The special named parameter 'options' in a message specification array is passed |
1546 | 1546 | * through to the $options parameter of wfMsgExt(). |
1547 | 1547 | * |
| 1548 | + * Don't use this for messages that are not in users interface language. |
| 1549 | + * |
1548 | 1550 | * For example: |
1549 | 1551 | * |
1550 | 1552 | * $wgOut->wrapWikiMsg( '<div class="error">$1</div>', 'some-error' ); |
— | — | @@ -1572,6 +1574,6 @@ |
1573 | 1575 | } |
1574 | 1576 | $s = str_replace( '$' . ($n+1), wfMsgExt( $name, $options, $args ), $s ); |
1575 | 1577 | } |
1576 | | - $this->addHTML( $this->parse( $s ) ); |
| 1578 | + $this->addHTML( $this->parse( $s, /*linestart*/true, /*uilang*/true ) ); |
1577 | 1579 | } |
1578 | 1580 | } |
Index: trunk/extensions/CentralAuth/SpecialCentralAuth.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | $globalUser = new CentralAuthUser( $this->mUserName ); |
63 | 63 | |
64 | 64 | if ( !$globalUser->exists() ) { |
65 | | - $this->showError( wfMsgNoTrans( 'centralauth-admin-nonexistent', $this->mUserName ) ); |
| 65 | + $this->showError( 'centralauth-admin-nonexistent', $this->mUserName ); |
66 | 66 | $this->showUsernameForm(); |
67 | 67 | return; |
68 | 68 | } |
— | — | @@ -70,49 +70,49 @@ |
71 | 71 | |
72 | 72 | if( $this->mPosted ) { |
73 | 73 | if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
74 | | - $this->showError( wfMsg( 'centralauth-token-mismatch' ) ); |
| 74 | + $this->showError( 'centralauth-token-mismatch' ); |
75 | 75 | } elseif( $this->mMethod == 'unmerge' ) { |
76 | 76 | $status = $globalUser->adminUnattach( $this->mDatabases ); |
77 | 77 | if ( !$status->isGood() ) { |
78 | | - $this->showError( $status->getWikiText() ); |
| 78 | + $this->showStatusError( $status->getWikiText() ); |
79 | 79 | } else { |
80 | 80 | global $wgLang; |
81 | | - $this->showSuccess( wfMsgNoTrans( 'centralauth-admin-unmerge-success', |
| 81 | + $this->showSuccess( 'centralauth-admin-unmerge-success', |
82 | 82 | $wgLang->formatNum( $status->successCount ), |
83 | | - $status->successCount ) ); |
| 83 | + /* deprecated */ $status->successCount ); |
84 | 84 | } |
85 | 85 | } elseif ( $this->mMethod == 'delete' ) { |
86 | 86 | $status = $globalUser->adminDelete(); |
87 | 87 | if ( !$status->isGood() ) { |
88 | | - $this->showError( $status->getWikiText() ); |
| 88 | + $this->showStatusError( $status->getWikiText() ); |
89 | 89 | } else { |
90 | 90 | global $wgLang; |
91 | | - $this->showSuccess( wfMsgNoTrans( 'centralauth-admin-delete-success', $this->mUserName ) ); |
| 91 | + $this->showSuccess( 'centralauth-admin-delete-success', $this->mUserName ); |
92 | 92 | $deleted = true; |
93 | 93 | $this->logAction( 'delete', $this->mUserName, $wgRequest->getVal( 'reason' ) ); |
94 | 94 | } |
95 | 95 | } elseif( $this->mMethod == 'lock' ) { |
96 | 96 | $status = $globalUser->adminLock(); |
97 | 97 | if ( !$status->isGood() ) { |
98 | | - $this->showError( $status->getWikiText() ); |
| 98 | + $this->showStatusError( $status->getWikiText() ); |
99 | 99 | } else { |
100 | 100 | global $wgLang; |
101 | | - $this->showSuccess( wfMsgNoTrans( 'centralauth-admin-lock-success', $this->mUserName ) ); |
| 101 | + $this->showSuccess( 'centralauth-admin-lock-success', $this->mUserName ); |
102 | 102 | $locked = true; |
103 | 103 | $this->logAction( 'lock', $this->mUserName, $wgRequest->getVal( 'reason' ) ); |
104 | 104 | } |
105 | 105 | } elseif( $this->mMethod == 'unlock' ) { |
106 | 106 | $status = $globalUser->adminUnlock(); |
107 | 107 | if ( !$status->isGood() ) { |
108 | | - $this->showError( $status->getWikiText() ); |
| 108 | + $this->showStatusError( $status->getWikiText() ); |
109 | 109 | } else { |
110 | 110 | global $wgLang; |
111 | | - $this->showSuccess( wfMsgNoTrans( 'centralauth-admin-unlock-success', $this->mUserName ) ); |
| 111 | + $this->showSuccess( 'centralauth-admin-unlock-success', $this->mUserName ); |
112 | 112 | $unlocked = true; |
113 | 113 | $this->logAction( 'unlock', $this->mUserName, $wgRequest->getVal( 'reason' ) ); |
114 | 114 | } |
115 | 115 | } else { |
116 | | - $this->showError( wfMsg( 'centralauth-admin-bad-input' ) ); |
| 116 | + $this->showError( 'centralauth-admin-bad-input' ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | } |
— | — | @@ -128,16 +128,31 @@ |
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | | - function showError( $message ) { |
| 132 | + function showStatusError( $wikitext ) { |
133 | 133 | global $wgOut; |
134 | | - $wgOut->addWikiText( "<div class='error'>\n$message</div>" ); |
| 134 | + $wrap = Xml::tags( 'div', array( 'class' => 'error' ), $s ); |
| 135 | + $wgOut->addHTML( $wgOut->parse( $wrap, /*linestart*/true, /*uilang*/true ) ); |
135 | 136 | } |
136 | 137 | |
137 | | - function showSuccess( $message ) { |
| 138 | + function showError( $message /* varargs */ ) { |
| 139 | + $args = func_get_args(); |
| 140 | + array_shift( $args ); // remove first |
| 141 | + $args = array_values( $args ); |
| 142 | + |
138 | 143 | global $wgOut; |
139 | | - $wgOut->addWikiText( "<div class='success'>\n$message</div>" ); |
| 144 | + $wgOut->wrapWikiMsg( '<div class="error">$1</div>', $message, $args ); |
140 | 145 | } |
141 | 146 | |
| 147 | + |
| 148 | + function showSuccess( $message /* varargs */ ) { |
| 149 | + $args = func_get_args(); |
| 150 | + array_shift( $args ); // remove first |
| 151 | + $args = array_values( $args ); |
| 152 | + |
| 153 | + global $wgOut; |
| 154 | + $wgOut->wrapWikiMsg( '<div class="success">$1</div>', $message, $args ); |
| 155 | + } |
| 156 | + |
142 | 157 | function showUsernameForm() { |
143 | 158 | global $wgOut, $wgScript; |
144 | 159 | $wgOut->addHtml( |
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | 'centralauth-admin-bad-input' => 'Invalid merge selection', |
140 | 140 | 'centralauth-admin-none-selected' => 'No accounts selected to modify.', |
141 | 141 | 'centralauth-admin-already-unmerged' => 'Skipping $1, already unmerged', |
142 | | - 'centralauth-admin-unmerge-success' => 'Successfully unmerged $1 {{PLURAL:$2|account|accounts}}', |
| 142 | + 'centralauth-admin-unmerge-success' => 'Successfully unmerged $1 {{PLURAL:$1|account|accounts}}', |
143 | 143 | 'centralauth-admin-delete-title' => 'Delete account', |
144 | 144 | 'centralauth-admin-delete-description' => 'Deleting the global account will delete any global preferences, unattach all local accounts, and leave the global name free for another user to take. |
145 | 145 | All local accounts will continue to exist. |