Skip to content

Commit

Permalink
(refs #1575) fixes i18n undefined bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinichiU committed Sep 12, 2011
1 parent d6d9d44 commit 4eb130f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
9 changes: 8 additions & 1 deletion apps/pc_frontend/modules/calendar/actions/actions.class.php
Expand Up @@ -68,7 +68,14 @@ public function executeIndex(sfWebRequest $request)
$col = 0;
}

$item = array();
$dayofweek = array(
'class' => array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'),
'item' => array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'),
);
$item = array(
'dayofweek_class_name' => $dayofweek['class'][$col],
'dayofweek_item_name' => $dayofweek['item'][$col],
);

if ($Day->isEmpty())
{
Expand Down
Expand Up @@ -32,11 +32,12 @@ private function getCalendar($w = 0)
{
include_once 'Calendar/Week.php';
$time = strtotime($w . ' week');

$Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 1);
$Week->build();
$dayofweek = array(
'en' => array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'),
'ja_JP' => array('', '', '', '', '', '', ''),
'class' => array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'),
'item' => array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'),
);

$calendar = array();
Expand All @@ -51,8 +52,8 @@ private function getCalendar($w = 0)
'month'=> $m,
'day' => $d,
'today' => 0 === $w && (int)date('d') === $d,
'dayofweek_en' => $dayofweek['en'][$i],
'dayofweek_ja' => $dayofweek['ja_JP'][$i],
'dayofweek_class_name' => $dayofweek['class'][$i],
'dayofweek_item_name' => $dayofweek['item'][$i],
'births' => $this->isSelf ? opCalendarPluginExtension::getScheduleBirthMemberByTargetDay($m, $d) : array(),
'events' => $this->isSelf ? opCalendarPluginExtension::getMyCommunityEventByTargetDay($y, $m, $d) : array(),
'schedules' => Doctrine::getTable('Schedule')->getScheduleByThisDayAndMember($y, $m, $d, $this->member),
Expand Down
6 changes: 3 additions & 3 deletions apps/pc_frontend/modules/calendar/templates/_weekly.php
Expand Up @@ -29,13 +29,13 @@
$cls_holiday = count($item['holidays']) ? ' holiday' : '';

$str_month = '';
if (1 == $item['day'] || 'mon' === $item['dayofweek_en'])
if (1 == $item['day'] || 'mon' === $item['dayofweek_class_name'])
{
$str_month = sprintf('%d/', $item['month']);
}
?>
<?php echo sprintf('<td class="%s%s%s">', $item['dayofweek_en'], $cls_today, $cls_holiday), "\n" ?>
<?php echo sprintf('<p class="day"><span class="date">%s%d</span> <span class="day">(%s)</span></p>', $str_month, $item['day'], $item['dayofweek_ja']), "\n" ?>
<?php echo sprintf('<td class="%s%s%s">', $item['dayofweek_class_name'], $cls_today, $cls_holiday), "\n" ?>
<?php echo sprintf('<p class="day"><span class="date">%s%d</span> <span class="day">(%s)</span></p>', $str_month, $item['day'], __($item['dayofweek_item_name'])), "\n" ?>
<?php foreach ($item['holidays'] as $holiday): ?>
<p class="holiday"><?php echo $holiday ?></p>
<?php endforeach ?>
Expand Down
6 changes: 3 additions & 3 deletions apps/pc_frontend/modules/calendar/templates/indexSuccess.php
Expand Up @@ -50,15 +50,15 @@
<?php
if (!isset($item['day']))
{
echo sprintf('<td class="%s empty"></td>', $item['dayofweek_en']), "\n";
echo sprintf('<td class="%s empty"></td>', $item['dayofweek_class_name']), "\n";
continue;
}

$cls_today = $item['today'] ? ' today' : '';
$cls_holiday = count($item['holidays']) ? ' holiday' : '';
?>
<?php echo sprintf('<td class="%s%s%s">', $item['dayofweek_en'], $cls_today, $cls_holiday), "\n" ?>
<p class="day"><span class="date"><?php echo $item['day'] ?></span></p>
<?php echo sprintf('<td class="%s%s%s">', $item['dayofweek_class_name'], $cls_today, $cls_holiday), "\n" ?>
<p class="day"><span class="date"><?php echo __($item['dayofweek_item_name']) ?></span></p>
<?php if ($isSelf && $add_schedule): ?>
<p class="new_schedule"><?php echo link_to(image_tag('/opCalendarPlugin/images/icon_schedule.gif', array('alt' => __('Add schedule'))), '@schedule_new_for_this_date?year='.$ym['year_disp'].'&month='.$ym['month_disp'].'&day='.$item['day']) ?></p>
<?php endif ?>
Expand Down
3 changes: 2 additions & 1 deletion lib/form/MiniScheduleForm.class.php
Expand Up @@ -25,10 +25,11 @@ public function configure()

private function generateWeeks()
{
$i18n = sfContext::getInstance()->getI18N();
foreach ($this->getOption('calendar', array()) as $item)
{
$nowTime = sprintf('%04d-%02d-%02d', (int)$item['year'], (int)$item['month'], (int)$item['day']);
$this->params[$nowTime] = sprintf('%d/%d(%s)', (int)$item['month'], (int)$item['day'], $item['dayofweek_ja']);
$this->params[$nowTime] = sprintf('%d/%d(%s)', (int)$item['month'], (int)$item['day'], $i18n->__($item['dayofweek_item_name']));
if ($item['today'])
{
$this->setDefault('start_date', $nowTime);
Expand Down

0 comments on commit 4eb130f

Please sign in to comment.