Index: trunk/extensions/Translate/TranslatePage.php |
— | — | @@ -221,7 +221,9 @@ |
222 | 222 | $groups = MessageGroups::singleton()->getGroups(); |
223 | 223 | $selector = new HTMLSelector( 'group', 'group', $this->options['group'] ); |
224 | 224 | foreach ( $groups as $id => $class ) { |
225 | | - $selector->addOption( $class->getLabel(), $id ); |
| 225 | + if ( MessageGroups::getGroup( $id )->exists() ) { |
| 226 | + $selector->addOption( $class->getLabel(), $id ); |
| 227 | + } |
226 | 228 | } |
227 | 229 | wfMemOut( __METHOD__ ); |
228 | 230 | return $selector->getHTML(); |
— | — | @@ -350,6 +352,7 @@ |
351 | 353 | $structure = array(); |
352 | 354 | |
353 | 355 | foreach ( $groups as $id => $o ) { |
| 356 | + if ( !MessageGroups::getGroup( $id )->exists() ) continue; |
354 | 357 | foreach ( $wgTranslateGroupStructure as $pattern => $hypergroup ) { |
355 | 358 | if ( preg_match( $pattern, $id ) ) { |
356 | 359 | // Emulate deepArraySet, because AFAIK php doesn't have one |
— | — | @@ -395,7 +398,6 @@ |
396 | 399 | public function formatGroupInformation( $blocks, $level = 2 ) { |
397 | 400 | global $wgUser; |
398 | 401 | |
399 | | - |
400 | 402 | if ( is_array( $blocks ) ) { |
401 | 403 | $block = array_shift( $blocks ); |
402 | 404 | } else { |
Index: trunk/extensions/Translate/Translate.css |
— | — | @@ -108,4 +108,20 @@ |
109 | 109 | |
110 | 110 | .mw-pt-languages-list { |
111 | 111 | padding: 0.5em; |
112 | | -} |
\ No newline at end of file |
| 112 | +} |
| 113 | + |
| 114 | +.mw-tpt-sp-legend { |
| 115 | + font-weight: bold; |
| 116 | +} |
| 117 | + |
| 118 | +.mw-tpt-sp-content { |
| 119 | + font-size: small; |
| 120 | + padding-left: 2em; |
| 121 | + padding-right: 2em; |
| 122 | + padding-bottom: 1ex; |
| 123 | +} |
| 124 | + |
| 125 | +.mw-tpt-sp-markform .diff-lineno, .mw-sp-translate-edit-fields .diff-lineno { |
| 126 | + /* Ideally there should be no line numbers in the first place */ |
| 127 | + display:none; |
| 128 | +} |
Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -233,6 +233,11 @@ |
234 | 234 | public static function factory( $label, $id ) { |
235 | 235 | return null; |
236 | 236 | } |
| 237 | + |
| 238 | + // Can be overwritten to retun false if something is wrong |
| 239 | + public function exists() { |
| 240 | + return true; |
| 241 | + } |
237 | 242 | } |
238 | 243 | |
239 | 244 | class CoreMessageGroup extends MessageGroup { |
— | — | @@ -395,6 +400,10 @@ |
396 | 401 | $writer->variableName = $this->getVariableName(); |
397 | 402 | return $writer; |
398 | 403 | } |
| 404 | + |
| 405 | + public function exists() { |
| 406 | + return is_readable( $this->getMessageFileWithPath( 'en' ) ); |
| 407 | + } |
399 | 408 | } |
400 | 409 | |
401 | 410 | class AliasMessageGroup extends ExtensionMessageGroup { |
— | — | @@ -614,7 +623,6 @@ |
615 | 624 | ksort( $defs ); |
616 | 625 | $new_defs = array(); |
617 | 626 | foreach ( $defs as $k => $v ) $new_defs[$prefix.$k] = $v; |
618 | | - |
619 | 627 | return $new_defs; |
620 | 628 | } |
621 | 629 | |
Index: trunk/extensions/Translate/tag/TranslatablePage.php |
— | — | @@ -301,8 +301,9 @@ |
302 | 302 | $temp[$collection->code] = sprintf( '%.2f', $percent ); |
303 | 303 | |
304 | 304 | } |
305 | | - // English is always up-to-date |
306 | | - $temp['en'] = 1.00; |
| 305 | + // Content language is always up-to-date |
| 306 | + global $wgContLang; |
| 307 | + $temp[$wgContLang->getCode()] = 1.00; |
307 | 308 | |
308 | 309 | $wgMemc->set( $memcKey, $temp, 60*60*12 ); |
309 | 310 | return $temp; |
— | — | @@ -361,23 +362,33 @@ |
362 | 363 | } |
363 | 364 | |
364 | 365 | protected function getTagId( $tag ) { |
| 366 | + $validTags = array( 'tp:mark', 'tp:tag', 'tp:transver' ); |
| 367 | + if ( !in_array( $tag, $validTags ) ) { |
| 368 | + throw new MWException( "Invalid tag $tag requested"); |
| 369 | + } |
| 370 | + |
| 371 | + // Simple static cache |
365 | 372 | static $tagcache = array(); |
366 | | - if ( !isset($tagcache[$tag]) ) { |
| 373 | + |
| 374 | + if ( !count($tagcache) ) { |
367 | 375 | $db = wfGetDB( DB_SLAVE ); |
368 | | - $tagcache[$tag] = $db->selectField( |
| 376 | + $res = $db->select( |
369 | 377 | 'revtag_type', // Table |
370 | | - 'rtt_id', // Field |
371 | | - array( 'rtt_name' => $tag ), // Conds |
| 378 | + array( 'rtt_name', 'rtt_id' ), |
| 379 | + array( 'rtt_name' => $validTags ), |
372 | 380 | __METHOD__ |
373 | 381 | ); |
| 382 | + foreach ( $res as $r ) { |
| 383 | + $tagcache[$r->rtt_name] = $r->rtt_id; |
| 384 | + } |
374 | 385 | } |
375 | 386 | return $tagcache[$tag]; |
376 | 387 | } |
377 | 388 | |
378 | 389 | public static function isTranslationPage( Title $title ) { |
379 | | - if ( $title->getText() === $title->getBaseText() ) return false; |
380 | | - |
381 | | - $newtitle = self::changeTitleText( $title, $title->getBaseText() ); |
| 390 | + list( $key, $code ) = TranslateUtils::figureMessage( $title->getText() ); |
| 391 | + if ( $key === '' || $code === '' ) return false; |
| 392 | + $newtitle = self::changeTitleText( $title, $key ); |
382 | 393 | if ( !$newtitle ) return false; |
383 | 394 | $page = TranslatablePage::newFromTitle( $newtitle ); |
384 | 395 | |
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -11,10 +11,6 @@ |
12 | 12 | SpecialPage::SpecialPage( 'PageTranslation' ); |
13 | 13 | } |
14 | 14 | |
15 | | - /** |
16 | | - * Access point for this special page. |
17 | | - * GLOBALS: $wgHooks, $wgOut. |
18 | | - */ |
19 | 15 | public function execute( $parameters ) { |
20 | 16 | wfLoadExtensionMessages( 'PageTranslation' ); |
21 | 17 | $this->setHeaders(); |
— | — | @@ -89,7 +85,7 @@ |
90 | 86 | $num = $wgLang->formatNum( $page->getParse()->countSections() ); |
91 | 87 | $link = SpecialPage::getTitleFor( 'Translate' )->getFullUrl( |
92 | 88 | array( 'group' => 'page|' . $page->getTitle()->getPrefixedText() ) ); |
93 | | - $wgOut->addHTML( wfMsgExt( 'tpt-saveok', array('parse'), $titleText, $num, $link ) ); |
| 89 | + $wgOut->addWikiMsg( 'tpt-saveok',$titleText, $num, $link ); |
94 | 90 | } |
95 | 91 | |
96 | 92 | public function loadPagesFromDB() { |
— | — | @@ -239,23 +235,34 @@ |
240 | 236 | } |
241 | 237 | |
242 | 238 | public function showPage( TranslatablePage $page, $sections ) { |
243 | | - global $wgOut, $wgScript; |
| 239 | + global $wgOut, $wgScript, $wgLang; |
244 | 240 | |
| 241 | + $wgOut->setSubtitle( $this->user->getSkin()->link( $page->getTitle() ) ); |
| 242 | + TranslateUtils::injectCSS(); |
245 | 243 | |
246 | 244 | $wgOut->addWikiMsg( 'tpt-showpage-intro' ); |
247 | 245 | |
| 246 | + $formParams = array( |
| 247 | + 'method' => 'post', |
| 248 | + 'action' => $this->getTitle()->getFullURL(), |
| 249 | + 'class' => 'mw-tpt-sp-markform' |
| 250 | + ); |
| 251 | + |
248 | 252 | $wgOut->addHTML( |
249 | | - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getFullURL() ) ) . |
| 253 | + Xml::openElement( 'form', $formParams ) . |
250 | 254 | Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ) . |
251 | 255 | Xml::hidden( 'revision', $page->getRevision() ) . |
252 | 256 | Xml::hidden( 'target', $page->getTitle()->getPrefixedtext() ) |
253 | 257 | ); |
254 | 258 | |
| 259 | + $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-oldnew' ); |
| 260 | + |
255 | 261 | foreach ( $sections as $s ) { |
256 | 262 | if ( $s->type === 'new' ) { |
257 | | - $name = wfMsgHtml('tpt-section-new') . ' ' . Xml::input( 'tpt-sect-' . $s->id, 10, $s->name ); |
| 263 | + $input = Xml::input( 'tpt-sect-' . $s->id, 10, $s->name ); |
| 264 | + $name = wfMsgHtml( 'tpt-section-new', $input ); |
258 | 265 | } else { |
259 | | - $name = wfMsgHtml('tpt-section') . ' ' . htmlspecialchars( $s->name ); |
| 266 | + $name = wfMsgHtml( 'tpt-section', htmlspecialchars($s->name) ); |
260 | 267 | } |
261 | 268 | |
262 | 269 | if ( $s->type === 'changed' ) { |
— | — | @@ -267,33 +274,61 @@ |
268 | 275 | $text = TranslateUtils::convertWhiteSpaceToHTML( $s->getText() ); |
269 | 276 | } |
270 | 277 | |
271 | | - $wgOut->addHTML( |
272 | | - Xml::openElement( 'fieldset' ) . |
273 | | - Xml::tags( 'legend', null, $name ) . |
274 | | - $text . |
275 | | - Xml::closeElement( 'fieldset' ) |
276 | | - ); |
| 278 | + $this->makeSectionElement( $name, $s->type, $text ); |
277 | 279 | } |
278 | 280 | |
279 | 281 | $deletedSections = $page->getParse()->getDeletedSections(); |
280 | | - if ( $num = count($deletedSections) ) { |
281 | | - $wgOut->addiHTML( wfMsgExt( 'tpt-deletedsections', array('parse'), $num ) ); |
| 282 | + if ( count($deletedSections) ) { |
| 283 | + $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-deleted' ); |
282 | 284 | foreach ( $deletedSections as $s ) { |
283 | | - $name = htmlspecialchars( $s->id ); |
284 | | - $wgOut->addHTML( |
285 | | - Xml::openElement( 'fieldset' ) . |
286 | | - Xml::tags( 'legend', null, wfMsgHtml('tpt-section') . ' ' . $name ) . |
287 | | - TranslateUtils::convertWhiteSpaceToHTML( $s->getText() ) . |
288 | | - Xml::closeElement( 'fieldset' ) |
289 | | - ); |
| 285 | + $name = wfMsgHtml( 'tpt-section-deleted', htmlspecialchars($s->id) ); |
| 286 | + $text = TranslateUtils::convertWhiteSpaceToHTML( $s->getText() ); |
| 287 | + $this->makeSectionElement( $name, $s->type, $text ); |
290 | 288 | } |
291 | 289 | } |
| 290 | + |
| 291 | + // Display template changes if applicable |
| 292 | + if ( $page->getMarkedTag() !== false ) { |
| 293 | + |
| 294 | + $newTemplate = $page->getParse()->getTemplatePretty(); |
| 295 | + $oldPage = TranslatablePage::newFromRevision( $page->getTitle(), $page->getMarkedTag() ); |
| 296 | + $oldTemplate = $oldPage->getParse()->getTemplatePretty(); |
| 297 | + |
| 298 | + if ( $oldTemplate !== $newTemplate ) { |
| 299 | + $wgOut->wrapWikiMsg( '==$1==', 'tpt-sections-template' ); |
| 300 | + |
| 301 | + $diff = new DifferenceEngine; |
| 302 | + $diff->setText( $oldTemplate, $newTemplate ); |
| 303 | + $text = $diff->getDiff( wfMsgHtml('tpt-diff-old'), wfMsgHtml('tpt-diff-new') ); |
| 304 | + $diff->showDiffStyle(); |
| 305 | + |
| 306 | + $contentParams = array( 'class' => 'mw-tpt-sp-content' ); |
| 307 | + $wgOut->addHTML( Xml::tags( 'div', $contentParams, $text ) ); |
| 308 | + } |
| 309 | + } |
| 310 | + |
292 | 311 | $wgOut->addHTML( |
293 | 312 | Xml::submitButton( wfMsg( 'tpt-submit' ) ) . |
294 | 313 | Xml::closeElement( 'form' ) |
295 | 314 | ); |
296 | 315 | } |
297 | 316 | |
| 317 | + protected function makeSectionElement( $legend, $type, $content ) { |
| 318 | + global $wgOut; |
| 319 | + |
| 320 | + $containerParams = array( 'class' => "mw-tpt-sp-section mw-tpt-sp-section-type-{$type}" ); |
| 321 | + $legendParams = array( 'class' => 'mw-tpt-sp-legend' ); |
| 322 | + $contentParams = array( 'class' => 'mw-tpt-sp-content' ); |
| 323 | + |
| 324 | + $wgOut->addHTML( |
| 325 | + Xml::tags( 'div', $containerParams, |
| 326 | + Xml::tags( 'div', $legendParams, $legend ) . |
| 327 | + Xml::tags( 'div', $contentParams, $content ) |
| 328 | + ) |
| 329 | + ); |
| 330 | + } |
| 331 | + |
| 332 | + |
298 | 333 | public function markForTranslation( TranslatablePage $page, $sections ) { |
299 | 334 | $text = $page->getParse()->getSourcePageText(); |
300 | 335 | |
Index: trunk/extensions/Translate/tag/TPParse.php |
— | — | @@ -26,6 +26,16 @@ |
27 | 27 | return $this->template; |
28 | 28 | } |
29 | 29 | |
| 30 | + public function getTemplatePretty() { |
| 31 | + $text = $this->template; |
| 32 | + $sections = $this->getSectionsForSave(); |
| 33 | + foreach ( $sections as $ph => $s ) { |
| 34 | + $text = str_replace( $ph, "<!--T:{$s->id}-->", $text ); |
| 35 | + } |
| 36 | + return $text; |
| 37 | + |
| 38 | + } |
| 39 | + |
30 | 40 | public function getSectionsForSave() { |
31 | 41 | $this->loadFromDatabase(); |
32 | 42 | |
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -142,10 +142,9 @@ |
143 | 143 | // Check if this is a source page or a translation page |
144 | 144 | $page = TranslatablePage::newFromTitle( $title ); |
145 | 145 | if ( $page->getMarkedTag() === false ) { |
146 | | - $title = Title::makeTitle( $title->getNamespace(), $title->getBaseText() ); |
147 | | - $page = TranslatablePage::newFromTitle( $title ); |
| 146 | + $page = TranslatablePage::isTranslationPage( $title ); |
148 | 147 | } |
149 | | - if ( $page->getMarkedTag() === false ) return ''; |
| 148 | + if ( $page === false || $page->getMarkedTag() === false ) return ''; |
150 | 149 | |
151 | 150 | |
152 | 151 | $status = $page->getTranslationPercentages(); |
— | — | @@ -248,7 +247,6 @@ |
249 | 248 | |
250 | 249 | // Here we disable editing of some existing or unknown pages |
251 | 250 | public static function translationsCheck( $title, $user, $action, &$result ) { |
252 | | - |
253 | 251 | // Case 1: Unknown section translations |
254 | 252 | if ( $title->getNamespace() == NS_TRANSLATIONS && $action === 'edit' ) { |
255 | 253 | $group = MessageIndex::titleToGroup( $title ); |
— | — | @@ -260,13 +258,13 @@ |
261 | 259 | return false; |
262 | 260 | } |
263 | 261 | |
264 | | - // Case 2: Target pages |
265 | | - } elseif( $title->getBaseText() != $title->getText() ) { |
266 | | - $newtitle = Title::makeTitle( $title->getNamespace(), $title->getBaseText() ); |
| 262 | + return true; |
| 263 | + } |
267 | 264 | |
268 | | - // Base page does not exists, cannot be translatable page |
269 | | - if ( !$newtitle || !$newtitle->exists() ) return true; |
270 | 265 | |
| 266 | + // Case 2: Target pages |
| 267 | + $page = TranslatablePage::isTranslationPage( $title ); |
| 268 | + if ( $page !== false ) { |
271 | 269 | // Local override of fuzzybot is allowed |
272 | 270 | global $wgTranslateFuzzyBotName; |
273 | 271 | if ( self::$allowTargetEdit || |
— | — | @@ -346,13 +344,23 @@ |
347 | 345 | $actions[] = $sk->link( $translate, $linkDesc, array(), $par); |
348 | 346 | } |
349 | 347 | |
350 | | - if ( $canmark && $wgUser->isAllowed('pagetranslation') ) { |
351 | | - $par = array( |
352 | | - 'target' => $title->getPrefixedText() |
353 | | - ); |
| 348 | + if ( $canmark ) { |
| 349 | + $diffUrl = $title->getFullUrl( array( 'diff' => $ready ) ); |
| 350 | + $par = array( 'target' => $title->getPrefixedText() ); |
354 | 351 | $translate = SpecialPage::getTitleFor( 'PageTranslation' ); |
355 | | - $linkDesc = wfMsgHtml( 'translate-tag-markthis' ); |
356 | | - $actions[] = $sk->link( $translate, $linkDesc, array(), $par); |
| 352 | + |
| 353 | + if ( $wgUser->isAllowed('pagetranslation') ) { |
| 354 | + // This page has never been marked |
| 355 | + if ( $marked === false ) { |
| 356 | + $linkDesc = wfMsgHtml( 'translate-tag-markthis' ); |
| 357 | + $actions[] = $sk->link( $translate, $linkDesc, array(), $par); |
| 358 | + } else { |
| 359 | + $markUrl = $translate->getFullUrl( $par ); |
| 360 | + $actions[] = wfMsgExt( 'translate-tag-markthisagain', 'parseinline', $diffUrl, $markUrl ); |
| 361 | + } |
| 362 | + } else { |
| 363 | + $actions[] = wfMsgExt( 'translate-tag-hasnew', 'parseinline', $diffUrl ); |
| 364 | + } |
357 | 365 | } |
358 | 366 | |
359 | 367 | if ( !count($actions) ) return; |
— | — | @@ -377,18 +385,27 @@ |
378 | 386 | $page = TranslatablePage::isTranslationPage( $title ); |
379 | 387 | if ( $page === false ) return; |
380 | 388 | |
| 389 | + list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); |
| 390 | + |
381 | 391 | // Get the translation percentage |
382 | 392 | $pers = $page->getTranslationPercentages(); |
383 | | - $per = @$pers[$title->getSubpageText()]; |
| 393 | + $per = @$pers[$code]; |
384 | 394 | $per = ($per === null) ? 0 : $per * 100; |
385 | 395 | $titleText = $page->getTitle()->getPrefixedText(); |
386 | | - $url = $page->getTranslationUrl( $title->getSubpageText() ); |
| 396 | + $url = $page->getTranslationUrl( $code ); |
387 | 397 | |
388 | 398 | // Output |
389 | 399 | wfLoadExtensionMessages( 'PageTranslation' ); |
390 | | - $wrap = '<div style="font-size: x-small; text-align: center">$1</div><hr />'; |
391 | | - $wgOut->wrapWikiMsg( $wrap, array( 'tpt-translation-intro', $url, $titleText, $per) ); |
| 400 | + $wrap = '<div style="font-size: x-small; text-align: center">$1</div>'; |
| 401 | + |
| 402 | + $wgOut->wrapWikiMsg( $wrap, array( 'tpt-translation-intro', $url, $titleText, $per) ); |
392 | 403 | |
| 404 | + if ( ((int) $per) < 100 ) { |
| 405 | + $wrap = '<div style="font-size: x-small; text-align: center" class="mw-translate-fuzzy">$1</div>'; |
| 406 | + $wgOut->wrapWikiMsg( $wrap, array( 'tpt-translation-intro-fuzzy' ) ); |
| 407 | + } |
| 408 | + $wgOut->addHTML( '<hr />' ); |
| 409 | + |
393 | 410 | } |
394 | 411 | |
395 | 412 | } |
\ No newline at end of file |
Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | | -class AllMediawikiExtensionsGroup extends ExtensionMessageGroup { |
| 180 | +class AllMediawikiExtensionsGroup extends MessageGroup { |
181 | 181 | protected $label = 'MediaWiki extensions'; |
182 | 182 | protected $id = 'ext-0-all'; |
183 | 183 | protected $meta = true; |
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | if ( $this->classes === null ) { |
203 | 203 | $this->classes = MessageGroups::singleton()->getGroups(); |
204 | 204 | foreach ( $this->classes as $index => $class ) { |
205 | | - if ( ( strpos( $class->getId(), 'ext-' ) !== 0 ) || $class->isMeta() ) { |
| 205 | + if ( ( strpos( $class->getId(), 'ext-' ) !== 0 ) || $class->isMeta() || !$class->exists() ) { |
206 | 206 | unset( $this->classes[$index] ); |
207 | 207 | } |
208 | 208 | } |
— | — | @@ -250,6 +250,14 @@ |
251 | 251 | } |
252 | 252 | return $bools; |
253 | 253 | } |
| 254 | + |
| 255 | + public function exists() { |
| 256 | + $this->init(); |
| 257 | + foreach ( $this->classes as $class ) { |
| 258 | + if ( $class->exists() ) return true; |
| 259 | + } |
| 260 | + return false; |
| 261 | + } |
254 | 262 | } |
255 | 263 | |
256 | 264 | class AllWikiaExtensionsGroup extends AllMediawikiExtensionsGroup { |
Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -399,4 +399,25 @@ |
400 | 400 | TranslateUtils::injectCSS(); |
401 | 401 | return Xml::tags( 'div', array( 'class' => 'mw-sp-translate-edit-fields' ), implode( "\n\n", $boxes ) ); |
402 | 402 | } |
| 403 | + |
| 404 | + public static function tabs( $skin, &$tabs ) { |
| 405 | + global $wgTranslateMessageNamespaces; |
| 406 | + $ns = $skin->mTitle->getNamespace(); |
| 407 | + |
| 408 | + if ( !in_array( $ns, $wgTranslateMessageNamespaces) ) return true; |
| 409 | + |
| 410 | + unset( $tabs['protect'] ); |
| 411 | + |
| 412 | + return true; |
| 413 | + } |
| 414 | + |
| 415 | + public static function keepFields( $edit, $out ) { |
| 416 | + global $wgRequest; |
| 417 | + $out->addHTML( "\n" . |
| 418 | + Xml::hidden( 'loadgroup', $wgRequest->getText( 'loadgroup' ) ) . |
| 419 | + Xml::hidden( 'loadtask', $wgRequest->getText( 'loadtask' ) ) . |
| 420 | + "\n" |
| 421 | + ); |
| 422 | + return true; |
| 423 | + } |
403 | 424 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -50,6 +50,8 @@ |
51 | 51 | $wgHooks['OutputPageBeforeHTML'][] = 'TranslateEditAddons::addNavigation'; |
52 | 52 | $wgHooks['AlternateEdit'][] = 'TranslateEditAddons::intro'; |
53 | 53 | $wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack'; |
| 54 | +$wgHooks['EditPage::showEditForm:fields'][] = 'TranslateEditAddons::keepFields'; |
| 55 | +$wgHooks['SkinTemplateTabs'][] = 'TranslateEditAddons::tabs'; |
54 | 56 | |
55 | 57 | $wgDefaultUserOptions['translate'] = 0; |
56 | 58 | $wgHooks['GetPreferences'][] = 'TranslatePreferences::onGetPreferences'; |
— | — | @@ -58,6 +60,7 @@ |
59 | 61 | $wgHooks['SpecialRecentChangesPanel'][] = 'TranslateRcFilter::translationFilterForm'; |
60 | 62 | $wgHooks['SkinTemplateToolboxEnd'][] = 'TranslateToolbox::toolboxAllTranslations'; |
61 | 63 | |
| 64 | + |
62 | 65 | $wgEnablePageTranslation = false; |
63 | 66 | $wgPageTranslationNamespace = 1198; |
64 | 67 | |
— | — | @@ -256,7 +259,7 @@ |
257 | 260 | function efTranslateCheckPT() { |
258 | 261 | global $wgHooks, $wgMemc; |
259 | 262 | |
260 | | - $version = 2; |
| 263 | + $version = "2"; // Must be a string |
261 | 264 | global $wgMemc; |
262 | 265 | $memcKey = wfMemcKey( 'pt' ); |
263 | 266 | $ok = $wgMemc->get( $memcKey ); |
Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -133,7 +133,8 @@ |
134 | 134 | $this->collection, |
135 | 135 | $this->group->getId(), |
136 | 136 | false, |
137 | | - $this->group->namespaces |
| 137 | + $this->group->namespaces, |
| 138 | + $this->getId() |
138 | 139 | ) . |
139 | 140 | $tablefooter; |
140 | 141 | } |
— | — | @@ -258,7 +259,8 @@ |
259 | 260 | $this->collection, |
260 | 261 | $this->group->getId(), |
261 | 262 | true, /* Review mode */ |
262 | | - $this->group->namespaces |
| 263 | + $this->group->namespaces, |
| 264 | + $this->getId() |
263 | 265 | ) . |
264 | 266 | $tablefooter; |
265 | 267 | } |
Index: trunk/extensions/Translate/PageTranslation.i18n.php |
— | — | @@ -14,12 +14,19 @@ |
15 | 15 | 'pagetranslation' => 'Page translation', |
16 | 16 | 'right-pagetranslation' => 'Mark versions of pages for translation', |
17 | 17 | 'tpt-desc' => 'Extension for translating content pages', |
18 | | - 'tpt-section' => 'Section:', |
19 | | - 'tpt-section-new' => 'New section:', |
| 18 | + 'tpt-section' => 'Translation unit $1', |
| 19 | + 'tpt-section-new' => 'New translation unit. Name: $1', |
| 20 | + 'tpt-section-deleted' => 'Translation unit $1', |
| 21 | + 'tpt-template' => 'Page template', |
| 22 | + 'tpt-templatediff' => 'The page template has changed.', |
20 | 23 | |
21 | 24 | 'tpt-diff-old' => 'Previous text', |
22 | 25 | 'tpt-diff-new' => 'New text', |
23 | 26 | 'tpt-submit' => 'Mark this version for translation', |
| 27 | + |
| 28 | + 'tpt-sections-oldnew' => 'New and existing translation units', |
| 29 | + 'tpt-sections-deleted' => 'Deleted translation units', |
| 30 | + 'tpt-sections-template' => 'Translation page template', |
24 | 31 | |
25 | 32 | # Specific page on the special page |
26 | 33 | 'tpt-badtitle' => 'Page name given ($1) is not a valid title', |
— | — | @@ -27,10 +34,9 @@ |
28 | 35 | Only latest versions can be marked for translation.', |
29 | 36 | 'tpt-notsuitable' => 'Page $1 is not suitable for translation. |
30 | 37 | Make sure it has <nowiki><translate></nowiki> tags and has a valid syntax.', |
31 | | - 'tpt-saveok' => 'The page "$1" has been marked up for translation with $2 translatable {{PLURAL:$2|section|sections}}. |
| 38 | + 'tpt-saveok' => 'The page [[$1]] has been marked up for translation with $2 {{PLURAL:$2|translation unit|translation units}}. |
32 | 39 | The page can now be <span class="plainlinks">[$3 translated]</span>.', |
33 | | - 'tpt-badsect' => '"$1" is not a valid name for section $2.', |
34 | | - 'tpt-deletedsections' => 'The following {{PLURAL:$1|section|sections}} will no longer be used:', |
| 40 | + 'tpt-badsect' => '"$1" is not a valid name for a translation unit $2.', |
35 | 41 | 'tpt-showpage-intro' => 'Below new, existing and deleted sections are listed. |
36 | 42 | Before marking this version for translation, check that the changes to sections are minimised to avoid unnecessary work for translators.', |
37 | 43 | 'tpt-mark-summary' => 'Marked this version for translation', |
— | — | @@ -42,15 +48,17 @@ |
43 | 49 | 'tpt-old-pages' => 'Some version of {{PLURAL:$1|this page has|these pages have}} been marked for translation.', |
44 | 50 | 'tpt-new-pages' => '{{PLURAL:$1|This page contains|These pages contain}} text with translation tags, but no version of {{PLURAL:$1|this page is|these pages are}} currently marked for translation.', |
45 | 51 | 'tpt-rev-latest' => 'latest version', |
46 | | - 'tpt-rev-old' => 'version $1', |
| 52 | + 'tpt-rev-old' => 'difference to previous marked version', |
47 | 53 | 'tpt-rev-mark-new' => 'mark this version for translation', |
48 | 54 | 'tpt-translate-this' => 'translate this page', |
49 | 55 | |
50 | 56 | # Source and translation page headers |
51 | 57 | 'translate-tag-translate-link-desc' => 'Translate this page', |
52 | 58 | 'translate-tag-markthis' => 'Mark this page for translation', |
53 | | - 'tpt-translation-intro' => 'This page is a <span class="plainlinks">[$1 translated version]</span> of a page [[$2]] and the translation is $3% complete and up to date. |
54 | | -<span class="mw-translate-fuzzy">Outdated translations are marked like this.</span>', |
| 59 | + 'translate-tag-markthisagain' => 'This page has <span class="plainlinks">[$1 changes]</span> since it was last <span class="plainlinks">[$2 marked for translation]</span>.', |
| 60 | + 'translate-tag-hasnew' => 'This page contains <span class="plainlinks">[$1 changes]</span> which are not marked for translation.', |
| 61 | + 'tpt-translation-intro' => 'This page is a <span class="plainlinks">[$1 translated version]</span> of a page [[$2]] and the translation is $3% complete and up to date.', |
| 62 | + 'tpt-translation-intro-fuzzy' => 'Outdated translations are marked like this.', |
55 | 63 | |
56 | 64 | 'tpt-languages-legend' => 'Other languages:', |
57 | 65 | |
— | — | @@ -71,7 +79,6 @@ |
72 | 80 | 'tpt-saveok' => '$1 is a page title, |
73 | 81 | $2 is a count of sections which can be used with PLURAL, |
74 | 82 | $3 is an URL.', |
75 | | - 'tpt-deletedsections' => '$1 is a count of sections.', |
76 | 83 | '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.', |
77 | 84 | 'tpt-rev-old' => '{{Identical|Version}}', |
78 | 85 | ); |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -159,8 +159,9 @@ |
160 | 160 | return $tableheader; |
161 | 161 | } |
162 | 162 | |
| 163 | + // Todo: extract to own class |
163 | 164 | public static function makeListing( MessageCollection $messages, $group, |
164 | | - $review = false, array $namespaces ) { |
| 165 | + $review = false, array $namespaces, $task = '' ) { |
165 | 166 | |
166 | 167 | global $wgUser; |
167 | 168 | $sk = $wgUser->getSkin(); |
— | — | @@ -196,7 +197,8 @@ |
197 | 198 | array(), |
198 | 199 | array( |
199 | 200 | 'action' => 'edit', |
200 | | - 'loadgroup' => $group |
| 201 | + 'loadgroup' => $group, |
| 202 | + 'loadtask' => $task |
201 | 203 | ), |
202 | 204 | 'known' |
203 | 205 | ); |