Skip to content

Commit

Permalink
(refs #2504) added Japanese translations for event creation error
Browse files Browse the repository at this point in the history
  • Loading branch information
martini2002jp committed Oct 26, 2011
1 parent 9ee90bc commit 2cd18bf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
24 changes: 22 additions & 2 deletions apps/mobile_frontend/i18n/community_event_form.ja.xml
Expand Up @@ -46,9 +46,29 @@
<source>Required.</source>
<target>必須項目です。</target>
</trans-unit>
<trans-unit id="">
<source>CSRF attack detected.</source>
<target>前の画面を読み直して、操作をやり直してください。</target>
</trans-unit>
<trans-unit id="">
<source>Unexpected extra form field named "%field%".</source>
<target>正しくありません。</target>
</trans-unit>
<trans-unit id="">
<source>The form submission cannot be processed. It probably means that you have uploaded a file that is too big.</source>
<target>送信に失敗しました。</target>
</trans-unit>
<trans-unit id="">
<source>The date must be after now.</source>
<target>募集期日は今日以降にしてください。</target>
</trans-unit>
<trans-unit id="">
<source>The open date must be after now.</source>
<target>開催日時は今日以降にしてください。</target>
</trans-unit>
<trans-unit id="">
<source>"%value%" is not an integer.</source>
<target>整数ではありません。</target>
<source>The application deadline must be before the open date.</source>
<target>募集期日は開催日時より後に指定できません。</target>
</trans-unit>
<trans-unit id="">
<source>Photo 1</source>
Expand Down
18 changes: 15 additions & 3 deletions apps/pc_frontend/i18n/community_event_form.ja.xml
Expand Up @@ -47,16 +47,28 @@
<target>必須項目です。</target>
</trans-unit>
<trans-unit id="">
<source>"%value%" is not an integer.</source>
<target>整数ではありません。</target>
<source>CSRF attack detected.</source>
<target>前の画面を読み直して、操作をやり直してください。</target>
</trans-unit>
<trans-unit id="">
<source>Unexpected extra form field named "%field%".</source>
<target>正しくありません。</target>
</trans-unit>
<trans-unit id="">
<source>The form submission cannot be processed. It probably means that you have uploaded a file that is too big.</source>
<target>送信に失敗しました。</target>
</trans-unit>
<trans-unit id="">
<source>The date must be after now.</source>
<target>募集期日は今日以降にしてください。</target>
</trans-unit>
<trans-unit id="">
<source>The open date must be after now.</source>
<target>開催日時は今日以降にしてください。</target>
</trans-unit>
<trans-unit id="">
<source>The application deadline must be before the open date.</source>
<target>募集期限は開催日時より後に指定できません。</target>
<target>募集期日は開催日時より後に指定できません。</target>
</trans-unit>
<trans-unit id="">
<source>Photo 1</source>
Expand Down
19 changes: 15 additions & 4 deletions lib/form/doctrine/PluginCommunityEventForm.class.php
Expand Up @@ -47,13 +47,16 @@ public function setup()
$this->setValidator('application_deadline', new sfValidatorDate(array(
'required' => false,
'min' => strtotime(date('Y-m-d'))
), array('min' => sfContext::getInstance()->getI18N()->__('The date must be after now.'))));
), array('min' => 'The date must be after now.')));

$this->setValidator('capacity', new sfValidatorInteger(array('required' => false, 'max' => 2147483647, 'min' => 0),
array('invalid' => 'Invalid.', 'max' => 'Invalid.', 'min' => 'Invalid.')));

$validatorOpenDate = new sfValidatorCallback(array('callback' => array($this, 'validateOpenDate')));
$this->mergePostValidator($validatorOpenDate);

$validatorApplicationDeadline = new sfValidatorCallback(array('callback' => array($this, 'validateApplicationDeadline')));
$validatorApplicationDeadline->addMessage('invalid_application_deadline', sfContext::getInstance()->getI18N()->__('The application deadline must be before the open date.'));
$validatorApplicationDeadline->addMessage('invalid_application_deadline', 'The application deadline must be before the open date.');
$this->mergePostValidator($validatorApplicationDeadline);

if (opMobileUserAgent::getInstance()->getMobile()->isNonMobile())
Expand Down Expand Up @@ -114,8 +117,16 @@ public function validateOpenDate($validator, $value)
{
if ($this->isNew())
{
$dateValidator = new sfValidatorDate(array('min' => strtotime(date('Y-m-d'))), array('min' => sfContext::getInstance()->getI18N()->__('The open date must be after now.')));
$value['open_date'] = $dateValidator->clean($value['open_date']);
$dateValidator = new sfValidatorDate(array('min' => strtotime(date('Y-m-d')), 'required' => false), array('min' => 'The open date must be after now.'));

try
{
$value['open_date'] = $dateValidator->clean($value['open_date']);
}
catch (sfValidatorError $e)
{
throw new sfValidatorErrorSchema($validator, array('open_date' => $e));
}
}

return $value;
Expand Down

0 comments on commit 2cd18bf

Please sign in to comment.