r108719 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108718‎ | r108719 | r108720 >
Date:12:35, 12 January 2012
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
I18n #410: some hacky code for adding help links
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)
  • /trunk/extensions/Translate/resources/ext.translate.helplink.css (added) (history)

Diff [purge]

Index: trunk/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: trunk/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: trunk/extensions/Translate/TranslateUtils.php
@@ -312,4 +312,17 @@
313313 return $selector;
314314 }
315315
 316+ /**
 317+ * @since 2012-01-12
 318+ */
 319+ public static function addSpecialHelpLink( OutputPage $out, /*string*/$to ) {
 320+ global $wgExtensionAssetsPath;
 321+
 322+ $out->addModules( 'ext.translate.helplink' );
 323+ $text = wfMessage( 'translate-gethelp' )->escaped();
 324+ $image = Html::element( 'img', array( 'src' => "$wgExtensionAssetsPath/Translate/resources/images/help.png" ) );
 325+ $link = Html::rawElement( 'a', array( 'href' => "//www.mediawiki.org/wiki/Special:MyLanguage/$to" ), "$image$text" );
 326+ $wrapper = Html::rawElement( 'div', array( 'class' => 'mw-translate-helplink' ), $link );
 327+ $out->addHtml( $wrapper );
 328+ }
316329 }
Index: trunk/extensions/Translate/resources/ext.translate.helplink.css
@@ -0,0 +1,19 @@
 2+.mw-translate-helplink {
 3+ position: relative;
 4+ margin-top: -10px;
 5+ float: right;
 6+}
 7+
 8+.mw-translate-helplink a {
 9+ display: block;
 10+ position: absolute;
 11+ width: 150px;
 12+ left: -150px;
 13+ text-align: right;
 14+ overflow: hidden;
 15+}
 16+
 17+.mw-translate-helplink img {
 18+ vertical-align: middle;
 19+ margin-right: 4px;
 20+}
Property changes on: trunk/extensions/Translate/resources/ext.translate.helplink.css
___________________________________________________________________
Added: svn:eol-style
121 + native

Sign-offs

UserFlagDate
Amire80inspected23:01, 16 January 2012
Amire80tested23:01, 16 January 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r108793Add image ping r108719nikerabbit08:37, 13 January 2012
r110310MFT 1.18wmf1 r108719 r108793 r108804 r108805 r109019 r109744 r109745 r109747 ...nikerabbit18:11, 30 January 2012

Comments

#Comment by Santhosh.thottingal (talk | contribs)   08:32, 13 January 2012

Forgot to add help.png?

#Comment by Nikerabbit (talk | contribs)   08:36, 13 January 2012

Yes.

#Comment by Amire80 (talk | contribs)   23:03, 16 January 2012

The location of the link on the screen may also be used by other extensions, templates or gadgets. This one is used on special pages, so templates like Template:Coords or various "featured" awards probably won't affect it, but with gadgets it's imaginable.

#Comment by Nikerabbit (talk | contribs)   06:05, 17 January 2012

As far as I know those use the space on the same level as the header, not below the header.

Status & tagging log