From 596c530250f96f003aa38dbf3e5cb7fb584fd16b Mon Sep 17 00:00:00 2001 From: Vasil Kolev Date: Tue, 20 Oct 2015 01:34:14 +0300 Subject: [PATCH] add langs array, localize the date --- schedule/parse.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/schedule/parse.php b/schedule/parse.php index 3282cc6..894bc85 100644 --- a/schedule/parse.php +++ b/schedule/parse.php @@ -12,6 +12,10 @@ $data = require __DIR__ . DIRECTORY_SEPARATOR . 'load.php'; /* sensible default */ if (empty($lang)) $lang = 'bg'; +/* no idea why do I have to write this, doesn't seem to exist in the system */ + +$languages = array('en' => array('name' => 'English', 'locale' => 'en_US.UTF8'), 'bg' => array ('name' => 'Български', 'locale' => 'bg_BG.UTF8')); + $cut_len = 70; $cfp_url = 'http://cfp.openfest.org'; $time = 0; @@ -31,8 +35,11 @@ foreach ($data['slots'] as $slot_id => $slot) { $slotDate = date('d', $slotTime); if ($slotDate !== $date) { + /* this seems to be the easiest way to localize the date */ + setlocale(LC_TIME, $languages[$lang]['locale']); + $localdate = strftime('%d %B - %A' ,$slotTime); $lines[] = ''; - $lines[] = '' . date('d F - l', $slotTime) . ''; + $lines[] = '' . $localdate . ''; $lines[] = ' '; $lines[] = ''; @@ -120,8 +127,8 @@ $legend = []; foreach($data['tracks'] as $track) { $legend[] = '' . $track['name'][$lang] . ''; } -foreach (array('en' => 'English', 'bg' => 'Български') as $l => $n) { - $legend[] = '' . $n . ''; +foreach ($languages as $l => $n) { + $legend[] = '' . $n['name'] . ''; } $gspk = [];