Index: trunk/extensions/Translate/Translate.magic.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$magicWords = array(); |
| 5 | + |
| 6 | +/** English (English) */ |
| 7 | +$magicWords['en'] = array( |
| 8 | + 'translationdialog' => array( 0, 'translationdialog' ), |
| 9 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/Translate/Translate.magic.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | $wgExtensionMessagesFiles['PageTranslation'] = $dir . 'PageTranslation.i18n.php'; |
49 | 49 | $wgExtensionMessagesFiles['TranslateGroupDescriptions'] = $dir . 'TranslateGroupDescriptions.i18n.php'; |
50 | 50 | $wgExtensionMessagesFiles['TranslateAlias'] = $dir . 'Translate.alias.php'; |
| 51 | +$wgExtensionMessagesFiles['TranslateMagic'] = $dir . 'Translate.magic.php'; |
51 | 52 | |
52 | 53 | // Register initialization code |
53 | 54 | $wgExtensionFunctions[] = 'TranslateHooks::setupTranslate'; |
Index: trunk/extensions/Translate/TranslateHooks.php |
— | — | @@ -155,6 +155,7 @@ |
156 | 156 | public static function setupParserHooks( $parser ) { |
157 | 157 | // For nice language list in-page |
158 | 158 | $parser->setHook( 'languages', array( 'PageTranslationHooks', 'languages' ) ); |
| 159 | + $parser->setFunctionHook( 'translationdialog', array( 'TranslateHooks', 'translationDialogMagicWord' ) ); |
159 | 160 | return true; |
160 | 161 | } |
161 | 162 | |
— | — | @@ -327,5 +328,28 @@ |
328 | 329 | return ''; |
329 | 330 | } |
330 | 331 | |
| 332 | + /** |
| 333 | + * Hook: ParserFirstCallInit |
| 334 | + */ |
| 335 | + public static function translationDialogMagicWord( Parser $parser, $title = '' ) { |
| 336 | + $title = Title::newFromText( $title ); |
| 337 | + $handle = new MessageHandle( $title ); |
| 338 | + $group = $handle->getGroup(); |
| 339 | + $callParams = array( $title->getPrefixedText(), $group->getId() ); |
| 340 | + $call = Xml::encodeJsCall( 'mw.translate.openDialog', $callParams ); |
331 | 341 | |
| 342 | + $js = <<<JAVASCRIPT |
| 343 | +mw.loader.using( 'ext.translate.quickedit', function() { $call; } ); return false; |
| 344 | +JAVASCRIPT; |
| 345 | + |
| 346 | + |
| 347 | + $a = array( |
| 348 | + 'href' => $title->getFullUrl( array( 'action' => 'edit' ) ), |
| 349 | + 'onclick' => $js, |
| 350 | + ); |
| 351 | + |
| 352 | + $output = Html::element( 'a', $a, wfMessage( 'translate-edit-jsopen' )->text() ); |
| 353 | + return $parser->insertStripItem( $output, $parser->mStripState ); |
| 354 | + } |
| 355 | + |
332 | 356 | } |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -71,6 +71,7 @@ |
72 | 72 | 'translate-optional' => '(optional)', |
73 | 73 | 'translate-ignored' => '(ignored)', |
74 | 74 | |
| 75 | + 'translate-edit-jsopen' => 'edit', |
75 | 76 | 'translate-edit-title' => 'Edit "$1"', |
76 | 77 | 'translate-edit-definition' => 'Message definition', |
77 | 78 | 'translate-edit-translation' => 'Translation', |
— | — | @@ -652,6 +653,7 @@ |
653 | 654 | 'translate-workflow-set-doing' => 'Submit button text when waiting for reply from server', |
654 | 655 | 'translate-workflow-set-done' => 'Submit button text when submission completed succesfully', |
655 | 656 | 'translate-stats-workflow' => 'Column header on Special:LanguageStats and Special:MessageGroupStats', |
| 657 | + 'translate-edit-jsopen' => 'Default linktext of <nowiki>{{#translationdialog:pagename}}</nowiki>', |
656 | 658 | ); |
657 | 659 | |
658 | 660 | /** Faeag Rotuma (Faeag Rotuma) |
Index: trunk/extensions/Translate/resources/ext.translate.quickedit.js |
— | — | @@ -86,15 +86,21 @@ |
87 | 87 | $identical.makeCollapsible(); |
88 | 88 | } |
89 | 89 | |
90 | | - form.find( '.mw-translate-next' ).click( function() { |
91 | | - mw.translate.openNext( page ); |
92 | | - } ); |
| 90 | + if ( mw.config.get( 'trlKeys' ) ) { |
| 91 | + form.find( '.mw-translate-next' ).click( function() { |
| 92 | + mw.translate.openNext( page ); |
| 93 | + } ); |
93 | 94 | |
94 | | - form.find( '.mw-translate-skip' ).click( function() { |
95 | | - mw.translate.openNext( page ); |
96 | | - dialog.dialog( 'close' ); |
97 | | - return false; |
98 | | - } ); |
| 95 | + form.find( '.mw-translate-skip' ).click( function() { |
| 96 | + mw.translate.openNext( page ); |
| 97 | + dialog.dialog( 'close' ); |
| 98 | + return false; |
| 99 | + } ); |
| 100 | + } else { |
| 101 | + form.find( '.mw-translate-next, .mw-translate-skip' ) |
| 102 | + .attr( 'disabled', 'disabled' ) |
| 103 | + .css( 'display', 'none' ); |
| 104 | + } |
99 | 105 | |
100 | 106 | form.find( '.mw-translate-history' ).click( function() { |
101 | 107 | window.open( mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?action=history&title=' + form.find( 'input[name=title]' ).val() ); |