r98013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98012‎ | r98013 | r98014 >
Date:17:55, 24 September 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Minor cleanup and line breaking to formatTimePeriod()
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/Language.php
@@ -3558,7 +3558,7 @@
35593559 */
35603560 function formatTimePeriod( $seconds, $format = array() ) {
35613561 if ( !is_array( $format ) ) {
3562 - $format = array( 'avoid' => $format, 'noabbrevs' => false ); // For backwards compatibility
 3562+ $format = array( 'avoid' => $format ); // For backwards compatibility
35633563 }
35643564 if ( !isset( $format['avoid'] ) ) {
35653565 $format['avoid'] = false;
@@ -3566,10 +3566,14 @@
35673567 if ( !isset( $format['noabbrevs' ] ) ) {
35683568 $format['noabbrevs'] = false;
35693569 }
3570 - $secondsMsg = wfMessage( $format['noabbrevs'] ? 'seconds' : 'seconds-abbrev' )->inLanguage( $this );
3571 - $minutesMsg = wfMessage( $format['noabbrevs'] ? 'minutes' : 'minutes-abbrev' )->inLanguage( $this );
3572 - $hoursMsg = wfMessage( $format['noabbrevs'] ? 'hours' : 'hours-abbrev' )->inLanguage( $this );
3573 - $daysMsg = wfMessage( $format['noabbrevs'] ? 'days' : 'days-abbrev' )->inLanguage( $this );
 3570+ $secondsMsg = wfMessage(
 3571+ $format['noabbrevs'] ? 'seconds' : 'seconds-abbrev' )->inLanguage( $this );
 3572+ $minutesMsg = wfMessage(
 3573+ $format['noabbrevs'] ? 'minutes' : 'minutes-abbrev' )->inLanguage( $this );
 3574+ $hoursMsg = wfMessage(
 3575+ $format['noabbrevs'] ? 'hours' : 'hours-abbrev' )->inLanguage( $this );
 3576+ $daysMsg = wfMessage(
 3577+ $format['noabbrevs'] ? 'days' : 'days-abbrev' )->inLanguage( $this );
35743578
35753579 if ( round( $seconds * 10 ) < 100 ) {
35763580 $s = $this->formatNum( sprintf( "%.1f", round( $seconds * 10 ) / 10 ) );

Comments

#Comment by Hashar (talk | contribs)   16:36, 17 October 2011

It seems you altered the default format when doing your test. The default is no more 'noabbrevs' => false !

if ( !is_array( $format ) ) {
-			$format = array( 'avoid' => $format, 'noabbrevs' => false ); // For backwards compatibility
+			$format = array( 'avoid' => $format ); // For backwards compatibility
#Comment by Aaron Schulz (talk | contribs)   06:15, 18 October 2011

There is an "if ( !isset( $format['noabbrevs' ] ) ) {" check below.

#Comment by Hashar (talk | contribs)   09:16, 18 October 2011

I guess I have to take the course "logical 101" again :D

Status & tagging log