r88190 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88189‎ | r88190 | r88191 >
Date:14:51, 15 May 2011
Author:robla
Status:ok (Comments)
Tags:
Comment:
Bug 28715 - Display what the server default timezone is in the timezone selection preference.
Modified paths:
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Preferences.php
@@ -1180,9 +1180,16 @@
11811181 static function getTimezoneOptions() {
11821182 $opt = array();
11831183
1184 - global $wgLocalTZoffset;
1185 -
1186 - $opt[wfMsg( 'timezoneuseserverdefault' )] = "System|$wgLocalTZoffset";
 1184+ global $wgLocalTZoffset, $wgLocaltimezone;
 1185+ // Check that $wgLocalTZoffset is the same as $wgLocaltimezone
 1186+ if ( $wgLocalTZoffset == date('Z') / 60 ) {
 1187+ $server_tz_msg = wfMsg( 'timezoneuseserverdefault', $wgLocaltimezone );
 1188+ }
 1189+ else {
 1190+ $tzstring = sprintf( '%+03d:%02d', floor( $wgLocalTZoffset / 60 ), abs( $wgLocalTZoffset ) % 60 );
 1191+ $server_tz_msg = wfMsg( 'timezoneuseserverdefault', $tzstring );
 1192+ }
 1193+ $opt[$server_tz_msg] = "System|$wgLocalTZoffset";
11871194 $opt[wfMsg( 'timezoneuseoffset' )] = 'other';
11881195 $opt[wfMsg( 'guesstimezone' )] = 'guess';
11891196
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1791,7 +1791,7 @@
17921792 'savedprefs' => 'Your preferences have been saved.',
17931793 'timezonelegend' => 'Time zone:',
17941794 'localtime' => 'Local time:',
1795 -'timezoneuseserverdefault' => 'Use server default',
 1795+'timezoneuseserverdefault' => 'Use wiki default ($1)',
17961796 'timezoneuseoffset' => 'Other (specify offset)',
17971797 'timezoneoffset' => 'Offset¹:',
17981798 'servertime' => 'Server time:',

Follow-up revisions

RevisionCommit summaryAuthorDate
r88222Follow-up r88190: coding stylenikerabbit09:59, 16 May 2011

Comments

#Comment by Reedy (talk | contribs)   10:13, 8 October 2011

Status & tagging log