r98117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98116‎ | r98117 | r98118 >
Date:08:42, 26 September 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Cleaned up Special:SupportedLanguages introduction summary message handling and added better default summary
Modified paths:
  • /trunk/extensions/Translate/README (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/groups/mediawiki-defines.txt (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialSupportedLanguages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/groups/mediawiki-defines.txt
@@ -1508,7 +1508,7 @@
15091509 aliasfile = Translate/Translate.alias.php
15101510 optional = translate-page-paging-links, translate-languagestats-groups, supportedlanguages-portallink, supportedlanguages-portallink-nocldr
15111511 optional = translate-edit-tab-next, translate-edit-tab-prev
1512 -ignored = translate-edit-tag-warning
 1512+ignored = translate-edit-tag-warning, supportedlanguages-localsummary
15131513
15141514 Translate - First Steps
15151515 id = ext-translate-firststeps
Index: trunk/extensions/Translate/README
@@ -30,6 +30,9 @@
3131
3232 == Change log ==
3333
 34+* 2011-09-26
 35+- Special:SupportedLanguages can now show site specific messages in
 36+ supportedlanguages-localsummary message
3437 * 2011-09-23
3538 - Change log up to date
3639 * 2011-09-21
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -255,14 +255,12 @@
256256
257257 # Special:SupportedLanguages
258258 'supportedlanguages' => 'Supported languages',
259 - 'supportedlanguages-summary' => 'This page displays a list of all the languages supported by {{SITENAME}}, together with the names of the translators working on that language.
260 -If you want more information on a particular language, you can click on the link to the portal for that language.
261 -Clicking on a translator name will take you to their user page.
262 -
263 -If a language is not listed, you can find out how to start a localization project for a language at "[[Translating:Process|New Language]]".
264 -
265 -If you translate to a language and your name is not included, please add your name to the list of translators on the [[:Category:Languages|portal]] for that language.
266 -See the menu bar for a link to the portal for the language of your preference.',
 259+ 'supportedlanguages-summary' => 'This page shows a list of all languages supported by {{SITENAME}},
 260+together with the names of the translators working on that language.
 261+A translator\'s name appears larger, the more edits the translator has contributed.
 262+The colour of an underline indicates how recently a translator has been active here.',
 263+ 'supportedlanguages-colorlegend' => 'Legend for the color: Last translation $1 days ago.',
 264+ 'supportedlanguages-localsummary' => '',
267265 'supportedlanguages-portallink' => '[$1] $2 - $3',
268266 'supportedlanguages-portallink-nocldr' => '[$1] $2',
269267 'supportedlanguages-translators' => '{{PLURAL:$2|Translator|Translators}}: $1',
Index: trunk/extensions/Translate/specials/SpecialSupportedLanguages.php
@@ -20,9 +20,12 @@
2121 * @ingroup SpecialPage TranslateSpecialPage
2222 */
2323 class SpecialSupportedLanguages extends SpecialPage {
24 - // Whether to skip and regenerate caches
 24+ /// Whether to skip and regenerate caches
2525 protected $purge = false;
2626
 27+ /// Cutoff time for inactivity in days
 28+ protected $period = 180;
 29+
2730 public function __construct() {
2831 parent::__construct( 'SupportedLanguages' );
2932 }
@@ -44,6 +47,8 @@
4548 }
4649
4750 $this->outputHeader();
 51+ $wgOut->addWikiMsg( 'supportedlanguages-colorlegend', $this->getColorLegend() );
 52+ $wgOut->addWikiMsg( 'supportedlanguages-localsummary' );
4853
4954 // Check if CLDR extension has been installed.
5055 $cldrInstalled = class_exists( 'LanguageNames' );
@@ -154,7 +159,7 @@
155160 $conds = array(
156161 'rc_title' . $dbr->buildLike( $dbr->anyString(), '/', $dbr->anyString() ),
157162 'rc_namespace' => $wgTranslateMessageNamespaces,
158 - 'rc_timestamp > ' . $dbr->timestamp( TS_DB, wfTimeStamp( TS_UNIX ) - 60 * 60 * 24 * 180 ),
 163+ 'rc_timestamp > ' . $dbr->timestamp( TS_DB, wfTimeStamp( TS_UNIX ) - 60 * 60 * 24 * $this->period ),
159164 );
160165 $options = array( 'GROUP BY' => 'lang', 'HAVING' => 'count > 20' );
161166
@@ -271,7 +276,7 @@
272277
273278 // Scale of the activity colors, anything
274279 // longer than this is just inactive
275 - $period = 180;
 280+ $period = $this->period;
276281
277282 $links = array();
278283
@@ -387,4 +392,12 @@
388393 $lb->execute();
389394 }
390395
 396+ protected function getColorLegend() {
 397+ $legend = '';
 398+ $period = $this->period;
 399+ for ( $i = 0; $i <= $period; $i+=30 ) {
 400+ $legend .= '<span style="background-color:#' . $this->getActivityColour( $period - $i, $period ) . "\"> $i</span>";
 401+ }
 402+ return $legend;
 403+ }
391404 }

Status & tagging log