Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -175,85 +175,116 @@ |
176 | 176 | return $pages; |
177 | 177 | } |
178 | 178 | |
| 179 | + protected function classifyPages( array $in ) { |
| 180 | + $out = array( |
| 181 | + 'proposed' => array(), |
| 182 | + 'active' => array(), |
| 183 | + 'broken' => array(), |
| 184 | + 'discouraged' => array(), |
| 185 | + ); |
| 186 | + |
| 187 | + foreach ( $in as $index => $page ) { |
| 188 | + if ( !isset( $page['tp:mark'] ) ) { |
| 189 | + // Never marked |
| 190 | + $out['proposed'][$index] = $page; |
| 191 | + } elseif ( $page['tp:tag'] === $page['latest'] ) { |
| 192 | + // Marked and latest version if fine |
| 193 | + $out['active'][$index] = $page; |
| 194 | + } else { |
| 195 | + // Marked but latest version if not fine |
| 196 | + $out['broken'][$index] = $page; |
| 197 | + } |
| 198 | + } |
| 199 | + |
| 200 | + // broken and proposed take preference over discouraged status |
| 201 | + foreach ( $out['active'] as $index => $page ) { |
| 202 | + $id = TranslatablePage::getMessageGroupIdFromTitle( $page['title'] ); |
| 203 | + $group = MessageGroups::getGroup( $id ); |
| 204 | + if ( MessageGroups::getPriority( $group ) === 'discouraged' ) { |
| 205 | + $out['discouraged'][$index] = $page; |
| 206 | + unset( $out['active'][$index] ); |
| 207 | + } |
| 208 | + } |
| 209 | + return $out; |
| 210 | + } |
| 211 | + |
179 | 212 | public function listPages() { |
180 | 213 | global $wgOut; |
| 214 | + $out = $wgOut; |
| 215 | + $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; |
181 | 216 | |
182 | 217 | $res = $this->loadPagesFromDB(); |
183 | | - $pages = $this->buildPageArray( $res ); |
184 | | - if ( !count( $pages ) ) { |
| 218 | + $allpages = $this->buildPageArray( $res ); |
| 219 | + if ( !count( $allpages ) ) { |
185 | 220 | $wgOut->addWikiMsg( 'tpt-list-nopages' ); |
186 | 221 | return; |
187 | 222 | } |
| 223 | + $types = $this->classifyPages( $allpages ); |
188 | 224 | |
189 | | - // Pages where mark <= tag |
190 | | - $items = array(); |
191 | | - foreach ( $pages as $index => $page ) { |
192 | | - if ( !isset( $page['tp:mark'] ) || !isset( $page['tp:tag'] ) ) { |
193 | | - continue; |
| 225 | + $pages = $types['proposed']; |
| 226 | + if ( count( $pages ) ) { |
| 227 | + $out->wrapWikiMsg( '== $1 ==', 'tpt-new-pages-title' ); |
| 228 | + $wgOut->addWikiMsg( 'tpt-new-pages', count( $pages ) ); |
| 229 | + $out->addHtml( '<ol>' ); |
| 230 | + foreach ( $pages as $page ) { |
| 231 | + $link = $linker->link( $page['title'] ); |
| 232 | + $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'new' ); |
| 233 | + $out->addHtml( "<li>$link $acts</li>" ); |
194 | 234 | } |
| 235 | + $out->addHtml( '</ol>' ); |
| 236 | + } |
195 | 237 | |
196 | | - if ( $page['tp:tag'] !== $page['latest'] ) { |
197 | | - continue; |
198 | | - } |
| 238 | + $pages = $types['active']; |
| 239 | + if ( count( $pages ) ) { |
| 240 | + $out->wrapWikiMsg( '== $1 ==', 'tpt-old-pages-title' ); |
| 241 | + $out->addWikiMsg( 'tpt-old-pages', count( $pages ) ); |
| 242 | + $out->addHtml( '<ol>' ); |
| 243 | + foreach ( $pages as $page ) { |
| 244 | + $link = $linker->link( $page['title'] ); |
| 245 | + $canUpdate = 'old'; |
| 246 | + if ( $page['tp:mark'] !== $page['tp:tag'] ) { |
| 247 | + $link = "<b>$link</b>"; |
| 248 | + $canUpdate = 'new'; |
| 249 | + } |
199 | 250 | |
200 | | - $link = $this->user->getSkin()->link( $page['title'] ); |
201 | | - if ( $page['tp:mark'] !== $page['tp:tag'] ) { |
202 | | - $link = "<b>$link</b>"; |
| 251 | + $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], $canUpdate ); |
| 252 | + $out->addHtml( "<li>$link $acts</li>" ); |
203 | 253 | } |
204 | | - $acts = $this->actionLinks( $page['title'], $page['tp:mark'], $page['latest'], 'old' ); |
205 | | - $items[] = "<li>$link $acts</li>"; |
206 | | - unset( $pages[$index] ); |
| 254 | + $out->addHtml( '</ol>' ); |
207 | 255 | } |
208 | 256 | |
209 | | - if ( count( $items ) ) { |
210 | | - $wgOut->addWikiMsg( 'tpt-old-pages', count( $items ) ); |
211 | | - $wgOut->addHtml( Html::rawElement( 'ol', null, implode( "\n", $items ) ) ); |
212 | | - $wgOut->addHtml( '<hr />' ); |
| 257 | + $pages = $types['broken']; |
| 258 | + if ( count( $pages ) ) { |
| 259 | + $out->wrapWikiMsg( '== $1 ==', 'tpt-other-pages-title' ); |
| 260 | + $out->addWikiMsg( 'tpt-other-pages', count( $pages ) ); |
| 261 | + $out->addHtml( '<ol>' ); |
| 262 | + foreach ( $pages as $page ) { |
| 263 | + $link = $linker->link( $page['title'] ); |
| 264 | + $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'stuck' ); |
| 265 | + $out->addHtml( "<li>$link $acts</li>" ); |
| 266 | + } |
| 267 | + $out->addHtml( '</ol>' ); |
213 | 268 | } |
214 | 269 | |
215 | | - // Pages which are never marked |
216 | | - $items = array(); |
217 | | - foreach ( $pages as $index => $page ) { |
218 | | - if ( isset( $page['tp:mark'] ) || !isset( $page['tp:tag'] ) ) { |
219 | | - continue; |
220 | | - } |
| 270 | + $pages = $types['discouraged']; |
| 271 | + if ( count( $pages ) ) { |
| 272 | + $out->wrapWikiMsg( '== $1 ==', 'tpt-discouraged-pages-title' ); |
| 273 | + $out->addWikiMsg( 'tpt-discouraged-pages', count( $pages ) ); |
| 274 | + $out->addHtml( '<ol>' ); |
| 275 | + foreach ( $pages as $page ) { |
| 276 | + $link = $linker->link( $page['title'] ); |
| 277 | + $canUpdate = 'old'; |
| 278 | + if ( $page['tp:mark'] !== $page['tp:tag'] ) { |
| 279 | + $link = "<b>$link</b>"; |
| 280 | + $canUpdate = 'new'; |
| 281 | + } |
221 | 282 | |
222 | | - /* Ignore pages which have had \<translate> at some point, but which |
223 | | - * have never been marked. */ |
224 | | - if ( $page['tp:tag'] !== $page['latest'] ) { |
225 | | - unset( $pages[$index] ); |
226 | | - continue; |
| 283 | + $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], $canUpdate ); |
| 284 | + $out->addHtml( "<li>$link $acts</li>" ); |
227 | 285 | } |
228 | | - |
229 | | - $link = $this->user->getSkin()->link( $page['title'] ); |
230 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'new' ); |
231 | | - $items[] = "<li>$link $acts</li>"; |
232 | | - |
233 | | - unset( $pages[$index] ); |
| 286 | + $out->addHtml( '</ol>' ); |
234 | 287 | } |
235 | 288 | |
236 | | - if ( count( $items ) ) { |
237 | | - $wgOut->addWikiMsg( 'tpt-new-pages', count( $items ) ); |
238 | | - $wgOut->addHtml( Html::rawElement( 'ol', null, implode( "\n", $items ) ) ); |
239 | | - $wgOut->addHtml( '<hr />' ); |
240 | | - } |
241 | | - |
242 | | - /* Pages which have been marked in the past, but newest version does |
243 | | - * not have a tag */ |
244 | | - $items = array(); |
245 | | - foreach ( $pages as $index => $page ) { |
246 | | - $link = $this->user->getSkin()->link( $page['title'] ); |
247 | | - $acts = $this->actionLinks( $page['title'], $page['tp:tag'], $page['latest'], 'stuck' ); |
248 | | - $items[] = "<li>$link $acts</li>"; |
249 | | - |
250 | | - unset( $pages[$index] ); |
251 | | - } |
252 | | - |
253 | | - if ( count( $items ) ) { |
254 | | - $wgOut->addWikiMsg( 'tpt-other-pages', count( $items ) ); |
255 | | - $wgOut->addHtml( Html::rawElement( 'ol', null, implode( "\n", $items ) ) ); |
256 | | - $wgOut->addHtml( '<hr />' ); |
257 | | - } |
258 | 289 | } |
259 | 290 | |
260 | 291 | /** |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -51,11 +51,19 @@ |
52 | 52 | |
53 | 53 | # Page list on the special page |
54 | 54 | 'tpt-list-nopages' => 'No pages are marked for translation nor ready to be marked for translation.', |
55 | | - 'tpt-old-pages' => 'Some version of {{PLURAL:$1|this page has|these pages have}} been marked for translation.', |
| 55 | + |
| 56 | + 'tpt-new-pages-title' => 'Pages proposed for translation', |
| 57 | + 'tpt-old-pages-title' => 'Pages in translation', |
| 58 | + 'tpt-other-pages-title' => 'Broken pages', |
| 59 | + 'tpt-discouraged-pages-title' => 'Discouraged pages', |
| 60 | + |
56 | 61 | 'tpt-new-pages' => '{{PLURAL:$1|This page contains|These pages contain}} text with translation tags, |
57 | 62 | but no version of {{PLURAL:$1|this page is|these pages are}} currently marked for translation.', |
| 63 | + 'tpt-old-pages' => 'Some version of {{PLURAL:$1|this page has|these pages have}} been marked for translation.', |
58 | 64 | 'tpt-other-pages' => '{{PLURAL:$1|An old version of this page is|Older versions of these pages are}} marked for translation, |
59 | 65 | but the latest {{PLURAL:$1|version|versions}} cannot be marked for translation.', |
| 66 | + 'tpt-discouraged-pages' => '{{PLURAL:$1|This page has|These pages have}} been discouraged from further translation.', |
| 67 | + |
60 | 68 | 'tpt-rev-mark-new' => 'mark this version for translation', |
61 | 69 | 'tpt-rev-unmark' => 'remove this page from translation', |
62 | 70 | |
— | — | @@ -196,8 +204,10 @@ |
197 | 205 | $2 is a count of sections which can be used with PLURAL, |
198 | 206 | $3 is an URL.', |
199 | 207 | 'tpt-mark-summary' => 'This message is used as an edit summary.', |
200 | | - 'tpt-old-pages' => 'The words "some version" refer to "one version of the page", or "a single version of each of the pages", respectively. Each page can have either one or none of its versions marked for translaton.', |
| 208 | + 'tpt-old-pages' => 'The words "some version" refer to "one version of the page", or "a single version of each of the pages", respectively. Each page can have either one or none of its versions marked for translaton. $1 is the number of pages', |
201 | 209 | 'tpt-other-pages' => '$1 is the number of pages in the following list.', |
| 210 | + 'tpt-new-pages' => '$1 is the number of pages in the following list.', |
| 211 | + 'tpt-discouraged-pages' => '$1 is the number of pages in the following list.', |
202 | 212 | 'tpt-rev-old' => '', |
203 | 213 | 'translate-tag-markthisagain' => '"has changes" is to be understood as "has been altered/edited"', |
204 | 214 | 'translate-tag-hasnew' => '"has changes" is to be understood as "has been altered/edited"', |
— | — | @@ -220,6 +230,10 @@ |
221 | 231 | 'pt-deletepage-action-check' => 'This is a button label. "List" is an imperative verb.', |
222 | 232 | 'pt-deletepage-current' => '{{Identical|Page name}}', |
223 | 233 | 'pt-deletepage-reason' => '{{Identical|Reason}}', |
| 234 | + 'tpt-new-pages-title' => 'Header in [[Special:PageTranslation]]', |
| 235 | + 'tpt-old-pages-title' => 'Header in [[Special:PageTranslation]]', |
| 236 | + 'tpt-other-pages-title' => 'Header in [[Special:PageTranslation]]', |
| 237 | + 'tpt-discouraged-pages-title' => 'Header in [[Special:PageTranslation]]', |
224 | 238 | ); |
225 | 239 | |
226 | 240 | /** ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ (ꢱꣃꢬꢵꢯ꣄ꢡ꣄ꢬꢵ) |