addDescription( 'Test various language time and date functions' ); } public function execute() { global $IP; foreach ( glob( "$IP/languages/messages/Messages*.php" ) as $filename ) { $base = basename( $filename ); $m = []; if ( !preg_match( '/Messages(.*)\.php$/', $base, $m ) ) { continue; } $code = str_replace( '_', '-', strtolower( $m[1] ) ); $this->output( "$code " ); $lang = Language::factory( $code ); $prefs = $lang->getDatePreferences(); if ( !$prefs ) { $prefs = [ 'default' ]; } $this->output( "date: " ); foreach ( $prefs as $index => $pref ) { if ( $index > 0 ) { $this->output( ' | ' ); } $this->output( $lang->date( $this->ts, false, $pref ) ); } $this->output( "\n$code time: " ); foreach ( $prefs as $index => $pref ) { if ( $index > 0 ) { $this->output( ' | ' ); } $this->output( $lang->time( $this->ts, false, $pref ) ); } $this->output( "\n$code both: " ); foreach ( $prefs as $index => $pref ) { if ( $index > 0 ) { $this->output( ' | ' ); } $this->output( $lang->timeanddate( $this->ts, false, $pref ) ); } $this->output( "\n\n" ); } } } $maintClass = DateFormats::class; require_once RUN_MAINTENANCE_IF_MAIN;