r49009 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49008‎ | r49009 | r49010 >
Date:15:57, 29 March 2009
Author:siebrand
Status:deferred
Tags:
Comment:
Suppress table header if there is nothing to report on, and show a message to encourage users to start review.
Modified paths:
  • /trunk/extensions/Translate/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialLanguageStats.php
@@ -162,20 +162,9 @@
163163 return $red . $green . $blue;
164164 }
165165
166 - /**
167 - * HTML for language statistics
168 - * Copied and adaped from groupStatistics.php by Nikerabbit
169 - * @param integer $code A language code (default empty, example: 'en').
170 - * @param bool $suppressComplete If completely translated groups should be suppressed
171 - * @return string HTML
172 - */
173 - function getGroupStats( $code, $suppressComplete = false ) {
174 - global $wgUser, $wgLang;
175 -
176 - $out = '';
177 -
 166+ function createHeader( $code ) {
178167 # FIXME: provide some sensible header for what is being displayed.
179 - $out .= '<!-- ' . $code . " -->\n";
 168+ $out = '<!-- ' . $code . " -->\n";
180169 $out .= '<!-- ' . TranslateUtils::getLanguageName( $code, false ) . " -->\n";
181170
182171 # Create table header
@@ -188,6 +177,21 @@
189178 $out .= $this->element( wfMsg( 'translate-percentage-fuzzy', true ) );
190179 $out .= $this->blockend();
191180
 181+ return $out;
 182+ }
 183+
 184+ /**
 185+ * HTML for language statistics
 186+ * Copied and adaped from groupStatistics.php by Nikerabbit
 187+ * @param integer $code A language code (default empty, example: 'en').
 188+ * @param bool $suppressComplete If completely translated groups should be suppressed
 189+ * @return string HTML
 190+ */
 191+ function getGroupStats( $code, $suppressComplete = false ) {
 192+ global $wgUser, $wgLang;
 193+
 194+ $out = '';
 195+
192196 # Fetch groups stats have to be displayed for
193197 $groups = $this->getGroups();
194198
@@ -237,7 +241,12 @@
238242 $out .= $this->blockend();
239243 }
240244
241 - $out .= $this->footer();
 245+ if( $out ) {
 246+ $out = $this->createHeader( $code ) . $out;
 247+ $out .= $this->footer();
 248+ } else {
 249+ $out = wfMsgExt( 'translate-nothing-to-do', 'parse' );
 250+ }
242251
243252 return $out;
244253 }
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -192,6 +192,8 @@
193193 'translate-untranslated' => 'Untranslated',
194194 'translate-percentage-complete' => 'Completion',
195195 'translate-percentage-fuzzy' => 'Outdated',
 196+ 'translate-nothing-to-do' => 'All possible translations appear to have been made.
 197+You are encouraged to review messages through [[Special:Translate|{{int:translate}}]].',
196198 'translate-languagestats-groups' => ' # Add message group IDs, one per line to restrict the message groups that
197199 # are shown on Special:LanguageStats. Non-existing message group IDs will
198200 # be ignored.', # do not duplicate this message to other languages

Status & tagging log