move the setting of the locale a bit, it's needed only once

This commit is contained in:
Vasil Kolev 2015-10-20 10:35:40 +03:00 committed by Openfest
parent aa97df05ee
commit 94ee8f6e23
1 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,9 @@ $hall_ids = array_keys($data['halls']);
$first_hall_id = min($hall_ids); $first_hall_id = min($hall_ids);
$last_hall_id = max($hall_ids); $last_hall_id = max($hall_ids);
/* We need to set these so we actually parse properly the dates. WP fucks up both. */
date_default_timezone_set('Europe/Sofia'); date_default_timezone_set('Europe/Sofia');
setlocale(LC_TIME, $languages[$lang]['locale']);
foreach ($data['slots'] as $slot_id => $slot) { foreach ($data['slots'] as $slot_id => $slot) {
$slotTime = $slot['starts_at']; $slotTime = $slot['starts_at'];
@ -36,7 +38,6 @@ foreach ($data['slots'] as $slot_id => $slot) {
if ($slotDate !== $date) { if ($slotDate !== $date) {
/* this seems to be the easiest way to localize the date */ /* this seems to be the easiest way to localize the date */
setlocale(LC_TIME, $languages[$lang]['locale']);
$localdate = strftime('%d %B - %A' ,$slotTime); $localdate = strftime('%d %B - %A' ,$slotTime);
$lines[] = '<tr>'; $lines[] = '<tr>';
$lines[] = '<td>' . $localdate . '</td>'; $lines[] = '<td>' . $localdate . '</td>';