r107056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107055‎ | r107056 | r107057 >
Date:11:15, 22 December 2011
Author:santhosh
Status:ok (Comments)
Tags:
Comment:
Get the help link from messages based on content language.
Modified paths:
  • /trunk/extensions/WebFonts/WebFonts.hooks.php (modified) (history)
  • /trunk/extensions/WebFonts/WebFonts.i18n.php (modified) (history)
  • /trunk/extensions/WebFonts/WebFonts.php (modified) (history)
  • /trunk/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/WebFonts.hooks.php
@@ -41,8 +41,16 @@
4242
4343 return true;
4444 }
45 -
 45+
4646 /**
 47+ * Hook: ResourceLoaderGetConfigVars
 48+ */
 49+ public static function addConfig( &$vars ) {
 50+ $vars['wgWebFontsHelpPage'] = wfMsgForContent( 'webfonts-help-page' );
 51+ return true;
 52+ }
 53+
 54+ /**
4755 * UserGetDefaultOptions hook handler.
4856 * @param $defaultOptions array
4957 * @return bool
Index: trunk/extensions/WebFonts/resources/ext.webfonts.js
@@ -328,10 +328,10 @@
329329 $fontsMenu.append( $resetItem );
330330
331331
332 -
 332+ var helpPage = mw.config.get( 'wgWebFontsHelpPage' );
333333 var $helpLink = $( '<a id="webfont-help-link" >' )
334334 .text( mw.msg( 'webfonts-help' ) )
335 - .prop( 'href', '//mediawiki.org/wiki/Special:MyLanguage/Help:Web_fonts' )
 335+ .prop( 'href', helpPage )
336336 .prop( 'target', '_blank');
337337 var $helpItem = $( '<li>' ).addClass( 'webfont-help-item' ).append( $helpLink );
338338 $fontsMenu.append( $helpItem );
Index: trunk/extensions/WebFonts/WebFonts.i18n.php
@@ -19,6 +19,7 @@
2020 'webfonts-enable-preference' => 'Enable font embedding (WebFonts)',
2121 'webfonts-menu-tooltip' => 'Select a font for the page',
2222 'webfonts-help' => 'Help',
 23+ 'webfonts-help-page' => '//mediawiki.org/wiki/Special:MyLanguage/Help:Web_fonts',
2324 );
2425
2526 /** Message documentation (Message documentation)
@@ -31,6 +32,7 @@
3233 'webfonts-reset' => '{{Identical|Reset}}',
3334 'webfonts-menu-tooltip' => 'Tooltip text displayed in the webfont link',
3435 'webfonts-help' => 'Text for the help link',
 36+ 'webfonts-help-page' => 'Change this only if you want to point the help link to a different wiki page.',
3537 );
3638
3739 /** Arabic (العربية)
Index: trunk/extensions/WebFonts/WebFonts.php
@@ -37,6 +37,7 @@
3838 $wgHooks['BeforePageDisplay'][] = 'WebFontsHooks::addModules';
3939 $wgHooks['GetPreferences'][] = 'WebFontsHooks::addPreference';
4040 $wgHooks['UserGetDefaultOptions'][] = 'WebFontsHooks::addDefaultOptions';
 41+$wgHooks['ResourceLoaderGetConfigVars'][] = 'WebFontsHooks::addConfig';
4142
4243 $wgWebFontsEnabledByDefault = true;
4344
@@ -57,7 +58,13 @@
5859 ),
5960 'localBasePath' => $dir,
6061 'remoteExtPath' => 'WebFonts',
61 - 'messages' => array( 'webfonts-load', 'webfonts-reset', 'webfonts-menu-tooltip' ),
62 - 'dependencies' => 'jquery.cookie' ,
 62+ 'messages' => array(
 63+ 'webfonts-load',
 64+ 'webfonts-reset',
 65+ 'webfonts-menu-tooltip',
 66+ 'webfonts-help',
 67+ 'webfonts-help-page',
 68+ ),
 69+ 'dependencies' => 'jquery.cookie',
6370 'position' => 'top',
6471 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r107057Remove webfonts-help-page from resourceloader....santhosh11:35, 22 December 2011
r107071r107056: This key is optinal for translatewiki.netraymond15:43, 22 December 2011
r107072r107056/r107071: Ignore key per Siebrand's CRraymond15:47, 22 December 2011
r107378I18ndeploy...nikerabbit13:32, 27 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107051Add a help link to WebFonts, pointing to mediawiki.org....santhosh10:01, 22 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   11:32, 22 December 2011

You don't need to load webfonts-help-page in resource loader.

Status & tagging log