r110310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110309‎ | r110310 | r110311 >
Date:18:11, 30 January 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/Translate/Translate.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/Translate.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/TranslateUtils.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/resources/ext.translate.helplink.css (added) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/resources/images (added) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialImportTranslations.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialMagic.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialManageGroups.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialSupportedLanguages.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslate.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslationStats.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslations.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/Translate/Translate.php
@@ -165,6 +165,11 @@
166166 'position' => 'top',
167167 ) + $resourcePaths;
168168
 169+$wgResourceModules['ext.translate.helplink'] = array(
 170+ 'styles' => 'resources/ext.translate.helplink.css',
 171+ 'position' => 'top',
 172+) + $resourcePaths;
 173+
169174 $wgResourceModules['ext.translate.messagetable'] = array(
170175 'scripts' => 'resources/ext.translate.messagetable.js',
171176 'styles' => 'resources/ext.translate.messagetable.css',
Index: branches/wmf/1.18wmf1/extensions/Translate/Translate.i18n.php
@@ -426,6 +426,8 @@
427427 'translate-dynagroup-byc' => 'Translation made by {{GENDER:$1|$1}} ($2)',
428428 'translate-dynagroup-last' => 'Latest change by {{GENDER:$1|$1}}',
429429 'translate-dynagroup-lastc' => 'Latest change by {{GENDER:$1|$1}} ($2)',
 430+
 431+ 'translate-gethelp' => 'Help',
430432 );
431433
432434 /** Message documentation (Message documentation)
@@ -685,6 +687,8 @@
686688 'translate-workflow-set-done' => 'Submit button text when submission completed succesfully',
687689 'translate-workflow-autocreated-summary' => 'This is an edit summary for the automatic creation of a workflow state page.',
688690 'translate-stats-workflow' => 'Column header on Special:LanguageStats and Special:MessageGroupStats',
 691+
 692+ 'translate-gethelp' => 'Link to some Translate help page or tutorial',
689693 );
690694
691695 /** Faeag Rotuma (Faeag Rotuma)
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialManageGroups.php
@@ -92,6 +92,7 @@
9393
9494 $groups = MessageGroups::singleton()->getGroups();
9595
 96+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Group_management' );
9697 $wgOut->wrapWikiMsg( '<h2>$1</h2>', 'translate-manage-listgroups' );
9798 $separator = wfMsg( 'word-separator' );
9899
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialImportTranslations.php
@@ -120,7 +120,7 @@
121121 global $wgOut;
122122
123123 $wgOut->addModules( 'ext.translate.special.importtranslations' );
124 -
 124+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Off-line_translation' );
125125 /**
126126 * Ugly but necessary form building ahead, ohoy
127127 */
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialSupportedLanguages.php
@@ -36,6 +36,7 @@
3737 $this->purge = $wgRequest->getVal( 'action' ) === 'purge';
3838
3939 $this->setHeaders();
 40+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Statistics_and_reporting#List_of_languages_and_translators' );
4041 $wgOut->addModules( 'ext.translate.special.supportedlanguages' );
4142
4243 $cache = wfGetCache( CACHE_ANYTHING );
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslate.php
@@ -60,6 +60,7 @@
6161 $errors = array();
6262
6363 if ( $this->options['group'] === '' ) {
 64+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Translation_example' );
6465 $this->groupInformation();
6566 return;
6667 }
@@ -81,6 +82,7 @@
8283 $this->options['group'] = $this->defaults['group'];
8384 }
8485
 86+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate' );
8587 // Show errors nicely.
8688 $wgOut->addHTML( $this->settingsForm( $errors ) );
8789
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslationStats.php
@@ -115,6 +115,7 @@
116116 global $wgOut, $wgScript;
117117
118118 $this->setHeaders();
 119+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Statistics_and_reporting' );
119120 $wgOut->addWikiMsg( 'translate-statsf-intro' );
120121
121122 $wgOut->addHTML(
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialMagic.php
@@ -138,6 +138,7 @@
139139
140140 $this->setup( $parameters );
141141 $this->setHeaders();
 142+ TranslateUtils::addSpecialHelpLink( $wgOut, '//translatewiki.net/wiki/FAQ#Special:AdvancedTranslate', true );
142143
143144 $wgOut->addHTML( $this->getForm() );
144145
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialTranslations.php
@@ -30,7 +30,6 @@
3131
3232 $this->setHeaders();
3333 $this->outputHeader();
34 -
3534 self::includeAssets();
3635
3736 if ( $this->including() ) {
@@ -54,7 +53,7 @@
5554 } else {
5655 $title = Title::newFromText( $par, $namespace );
5756 }
58 -
 57+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Statistics_and_reporting#Translations_in_all_languages' );
5958 if ( !$title ) {
6059 $title = Title::makeTitle( NS_MEDIAWIKI, '' );
6160 $wgOut->addHTML( $this->namespaceMessageForm( $title ) );
Index: branches/wmf/1.18wmf1/extensions/Translate/specials/SpecialLanguageStats.php
@@ -120,6 +120,7 @@
121121 }
122122
123123 if ( !$this->including() ) {
 124+ TranslateUtils::addSpecialHelpLink( $wgOut, 'Help:Extension:Translate/Statistics_and_reporting' );
124125 $wgOut->addHTML( $this->getForm() );
125126 }
126127
Index: branches/wmf/1.18wmf1/extensions/Translate/TranslateUtils.php
@@ -4,7 +4,7 @@
55 *
66 * @file
77 * @author Niklas Laxström
8 - * @copyright Copyright © 2007, 2009 Niklas Laxström
 8+ * @copyright Copyright © 2007, 2012 Niklas Laxström
99 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1010 */
1111
@@ -312,4 +312,27 @@
313313 return $selector;
314314 }
315315
 316+ /**
 317+ * @since 2012-01-12
 318+ */
 319+ public static function addSpecialHelpLink( OutputPage $out, /*string*/$to, $overrideBaseUrl = false ) {
 320+ $out->addModules( 'ext.translate.helplink' );
 321+ $text = wfMessage( 'translate-gethelp' )->escaped();
 322+
 323+ if( $overrideBaseUrl ) {
 324+ $helpUrl = $to;
 325+ } else {
 326+ $helpUrl = "//www.mediawiki.org/wiki/Special:MyLanguage/$to";
 327+ }
 328+
 329+ $link = Html::rawElement(
 330+ 'a',
 331+ array(
 332+ 'href' => $helpUrl,
 333+ 'target' => '_blank'
 334+ ),
 335+ "$text" );
 336+ $wrapper = Html::rawElement( 'div', array( 'class' => 'mw-translate-helplink' ), $link );
 337+ $out->addHtml( $wrapper );
 338+ }
316339 }
Index: branches/wmf/1.18wmf1/extensions/Translate/resources/ext.translate.helplink.css
@@ -0,0 +1,14 @@
 2+.mw-translate-helplink {
 3+ position: absolute;
 4+ width: 100%;
 5+ display: block;
 6+ margin-top: -10px;
 7+}
 8+
 9+.mw-translate-helplink a {
 10+ /* @embed */
 11+ background: url(images/help.png) no-repeat scroll left center transparent;
 12+ padding-left: 20px;
 13+ float: right;
 14+}
 15+
Property changes on: branches/wmf/1.18wmf1/extensions/Translate/resources/ext.translate.helplink.css
___________________________________________________________________
Added: svn:eol-style
116 + native
Index: branches/wmf/1.18wmf1/extensions/Translate/resources/images/help.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: branches/wmf/1.18wmf1/extensions/Translate/resources/images/help.png
___________________________________________________________________
Added: svn:mime-type
217 + image/png

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108719I18n #410: some hacky code for adding help linksnikerabbit12:35, 12 January 2012
r108793Add image ping r108719nikerabbit08:37, 13 January 2012
r108804Add help links for special pages of Translate....santhosh11:11, 13 January 2012
r108805Add help link to the main page of Special:Translate too....santhosh11:25, 13 January 2012
r109019Add Help links to Special:Translations and Special:ImportTranslations pages.santhosh08:55, 16 January 2012
r109744Open the Translate help page in a new tab/window.siebrand19:09, 22 January 2012
r109745Fix link to help page.siebrand19:13, 22 January 2012
r109747Update help link.siebrand19:22, 22 January 2012
r109749Add overrideBaseUrl setting to TranslateUtils::addSpecialHelpLink()....siebrand19:33, 22 January 2012
r109750Update and add help links.siebrand19:44, 22 January 2012
r109754Follow-up r109750: Update help link for Special:SupportedLanguages.siebrand20:33, 22 January 2012
r109806Update the help link for Special:Translations....santhosh04:40, 23 January 2012

Status & tagging log