Changeset 24015
- Timestamp:
- 11/16/09 14:33:34 (3 years ago)
- Files:
-
- branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml (modified) (1 diff)
- branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml (modified) (1 diff)
- branches/1.3/lib/widget/sfWidgetFormDateRange.class.php (modified) (1 diff)
- branches/1.3/lib/widget/sfWidgetFormFilterDate.class.php (modified) (2 diffs)
- branches/1.3/lib/widget/sfWidgetFormFilterInput.class.php (modified) (1 diff)
- branches/1.3/lib/widget/sfWidgetFormInputFileEditable.class.php (modified) (2 diffs)
- branches/1.3/test/unit/widget/sfWidgetFormDateRangeTest.php (added)
- branches/1.3/test/unit/widget/sfWidgetFormFilterDateTest.php (added)
- branches/1.3/test/unit/widget/sfWidgetFormFilterInputTest.php (added)
- branches/1.3/test/unit/widget/sfWidgetFormInputFileEditableTest.php (modified) (2 diffs)
- branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml (modified) (1 diff)
- branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml (modified) (1 diff)
- branches/1.4/lib/widget/sfWidgetFormDateRange.class.php (modified) (1 diff)
- branches/1.4/lib/widget/sfWidgetFormFilterDate.class.php (modified) (2 diffs)
- branches/1.4/lib/widget/sfWidgetFormFilterInput.class.php (modified) (1 diff)
- branches/1.4/lib/widget/sfWidgetFormInputFileEditable.class.php (modified) (2 diffs)
- branches/1.4/test/unit/widget/sfWidgetFormDateRangeTest.php (added)
- branches/1.4/test/unit/widget/sfWidgetFormFilterDateTest.php (added)
- branches/1.4/test/unit/widget/sfWidgetFormFilterInputTest.php (added)
- branches/1.4/test/unit/widget/sfWidgetFormInputFileEditableTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml
r13399 r24015 122 122 <target>Das Objekt wurde erfolgreich gelöscht.</target> 123 123 </trans-unit> 124 <trans-unit> 125 <source>is empty</source> 126 <target>ist leer</target> 127 </trans-unit> 128 <trans-unit> 129 <source>yes or no</source> 130 <target>Ja oder Nein</target> 131 </trans-unit> 132 <trans-unit> 133 <source>yes</source> 134 <target>Ja</target> 135 </trans-unit> 136 <trans-unit> 137 <source>no</source> 138 <target>Nein</target> 139 </trans-unit> 140 <trans-unit> 141 <source><![CDATA[from %from_date% to %to_date%]]></source> 142 <target><![CDATA[von %from_date% bis %to_date%]]></target> 143 </trans-unit> 144 <trans-unit> 145 <source><![CDATA[from %from_date%<br />to %to_date%]]></source> 146 <target><![CDATA[von %from_date%<br />bis %to_date%]]></target> 147 </trans-unit> 124 148 </body> 125 149 </file> branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml
r20548 r24015 146 146 <target>Un problème est survenu lors de la suppression des objets sélectionnés.</target> 147 147 </trans-unit> 148 <trans-unit> 149 <source>is empty</source> 150 <target>est vide</target> 151 </trans-unit> 152 <trans-unit> 153 <source>yes or no</source> 154 <target>oui ou non</target> 155 </trans-unit> 156 <trans-unit> 157 <source>yes</source> 158 <target>oui</target> 159 </trans-unit> 160 <trans-unit> 161 <source>no</source> 162 <target>non</target> 163 </trans-unit> 164 <trans-unit> 165 <source><![CDATA[from %from_date% to %to_date%]]></source> 166 <target><![CDATA[du %from_date% au %to_date%]]></target> 167 </trans-unit> 168 <trans-unit> 169 <source><![CDATA[from %from_date%<br />to %to_date%]]></source> 170 <target><![CDATA[du %from_date%<br />au %to_date%]]></target> 171 </trans-unit> 148 172 </body> 149 173 </file> branches/1.3/lib/widget/sfWidgetFormDateRange.class.php
r12873 r24015 56 56 $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); 57 57 58 return strtr($this-> getOption('template'), array(58 return strtr($this->translate($this->getOption('template')), array( 59 59 '%from_date%' => $this->getOption('from_date')->render($name.'[from]', $value['from']), 60 60 '%to_date%' => $this->getOption('to_date')->render($name.'[to]', $value['to']), branches/1.3/lib/widget/sfWidgetFormFilterDate.class.php
r19243 r24015 4 4 * This file is part of the symfony package. 5 5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 63 63 '%date_range%' => parent::render($name, $value, $attributes, $errors), 64 64 '%empty_checkbox%' => $this->getOption('with_empty') ? $this->renderTag('input', array('type' => 'checkbox', 'name' => $name.'[is_empty]', 'checked' => $values['is_empty'] ? 'checked' : '')) : '', 65 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this-> getOption('empty_label'), array('for' => $this->generateId($name.'[is_empty]'))) : '',65 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this->translate($this->getOption('empty_label')), array('for' => $this->generateId($name.'[is_empty]'))) : '', 66 66 )); 67 67 } branches/1.3/lib/widget/sfWidgetFormFilterInput.class.php
r13510 r24015 58 58 '%input%' => $this->renderTag('input', array_merge(array('type' => 'text', 'id' => $this->generateId($name), 'name' => $name.'[text]', 'value' => $values['text']), $attributes)), 59 59 '%empty_checkbox%' => $this->getOption('with_empty') ? $this->renderTag('input', array('type' => 'checkbox', 'name' => $name.'[is_empty]', 'checked' => $values['is_empty'] ? 'checked' : '')) : '', 60 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this-> getOption('empty_label'), array('for' => $this->generateId($name.'[is_empty]'))) : '',60 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this->translate($this->getOption('empty_label')), array('for' => $this->generateId($name.'[is_empty]'))) : '', 61 61 )); 62 62 } branches/1.3/lib/widget/sfWidgetFormInputFileEditable.class.php
r22869 r24015 4 4 * This file is part of the symfony package. 5 5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 85 85 86 86 $delete = $this->renderTag('input', array_merge(array('type' => 'checkbox', 'name' => $deleteName), $attributes)); 87 $deleteLabel = $this->renderContentTag('label', $this->getOption('delete_label'), array_merge(array('for' => $this->generateId($deleteName)))); 87 $deleteLabel = $this->translate($this->getOption('delete_label')); 88 $deleteLabel = $this->renderContentTag('label', $deleteLabel, array_merge(array('for' => $this->generateId($deleteName)))); 88 89 } 89 90 else branches/1.3/test/unit/widget/sfWidgetFormInputFileEditableTest.php
r19531 r24015 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(6); 13 class FormFormatterStub extends sfWidgetFormSchemaFormatter 14 { 15 public function __construct() {} 16 17 public function translate($subject, $parameters = array()) 18 { 19 return sprintf('translation[%s]', $subject); 20 } 21 } 22 23 $t = new lime_test(7); 14 24 15 25 // ->render() … … 46 56 $t->is($w->render('foo'), '-foo-<br /><input type="file" name="foo" id="foo" /><br /><input type="checkbox" name="foo_delete" id="foo_delete" /> <label for="foo_delete">delete</label>', '->render() renders the widget as HTML'); 47 57 58 $t->diag('delete label translation'); 59 $ws = new sfWidgetFormSchema(); 60 $ws->addFormFormatter('stub', new FormFormatterStub()); 61 $ws->setFormFormatterName('stub'); 62 $w = new sfWidgetFormInputFileEditable(array( 63 'file_src' => '-foo-', 64 )); 65 $w->setParent($ws); 66 $t->is($w->render('foo'), '-foo-<br /><input type="file" name="foo" id="foo" /><br /><input type="checkbox" name="foo_delete" id="foo_delete" /> <label for="foo_delete">translation[remove the current file]</label>', '->render() renders the widget as HTML'); 67 48 68 $t->diag('is_image option'); 49 69 $w = new sfWidgetFormInputFileEditable(array( branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml
r13399 r24015 122 122 <target>Das Objekt wurde erfolgreich gelöscht.</target> 123 123 </trans-unit> 124 <trans-unit> 125 <source>is empty</source> 126 <target>ist leer</target> 127 </trans-unit> 128 <trans-unit> 129 <source>yes or no</source> 130 <target>Ja oder Nein</target> 131 </trans-unit> 132 <trans-unit> 133 <source>yes</source> 134 <target>Ja</target> 135 </trans-unit> 136 <trans-unit> 137 <source>no</source> 138 <target>Nein</target> 139 </trans-unit> 140 <trans-unit> 141 <source><![CDATA[from %from_date% to %to_date%]]></source> 142 <target><![CDATA[von %from_date% bis %to_date%]]></target> 143 </trans-unit> 144 <trans-unit> 145 <source><![CDATA[from %from_date%<br />to %to_date%]]></source> 146 <target><![CDATA[von %from_date%<br />bis %to_date%]]></target> 147 </trans-unit> 124 148 </body> 125 149 </file> branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml
r20548 r24015 146 146 <target>Un problème est survenu lors de la suppression des objets sélectionnés.</target> 147 147 </trans-unit> 148 <trans-unit> 149 <source>is empty</source> 150 <target>est vide</target> 151 </trans-unit> 152 <trans-unit> 153 <source>yes or no</source> 154 <target>oui ou non</target> 155 </trans-unit> 156 <trans-unit> 157 <source>yes</source> 158 <target>oui</target> 159 </trans-unit> 160 <trans-unit> 161 <source>no</source> 162 <target>non</target> 163 </trans-unit> 164 <trans-unit> 165 <source><![CDATA[from %from_date% to %to_date%]]></source> 166 <target><![CDATA[du %from_date% au %to_date%]]></target> 167 </trans-unit> 168 <trans-unit> 169 <source><![CDATA[from %from_date%<br />to %to_date%]]></source> 170 <target><![CDATA[du %from_date%<br />au %to_date%]]></target> 171 </trans-unit> 148 172 </body> 149 173 </file> branches/1.4/lib/widget/sfWidgetFormDateRange.class.php
r12873 r24015 56 56 $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); 57 57 58 return strtr($this-> getOption('template'), array(58 return strtr($this->translate($this->getOption('template')), array( 59 59 '%from_date%' => $this->getOption('from_date')->render($name.'[from]', $value['from']), 60 60 '%to_date%' => $this->getOption('to_date')->render($name.'[to]', $value['to']), branches/1.4/lib/widget/sfWidgetFormFilterDate.class.php
r19243 r24015 4 4 * This file is part of the symfony package. 5 5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 63 63 '%date_range%' => parent::render($name, $value, $attributes, $errors), 64 64 '%empty_checkbox%' => $this->getOption('with_empty') ? $this->renderTag('input', array('type' => 'checkbox', 'name' => $name.'[is_empty]', 'checked' => $values['is_empty'] ? 'checked' : '')) : '', 65 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this-> getOption('empty_label'), array('for' => $this->generateId($name.'[is_empty]'))) : '',65 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this->translate($this->getOption('empty_label')), array('for' => $this->generateId($name.'[is_empty]'))) : '', 66 66 )); 67 67 } branches/1.4/lib/widget/sfWidgetFormFilterInput.class.php
r13510 r24015 58 58 '%input%' => $this->renderTag('input', array_merge(array('type' => 'text', 'id' => $this->generateId($name), 'name' => $name.'[text]', 'value' => $values['text']), $attributes)), 59 59 '%empty_checkbox%' => $this->getOption('with_empty') ? $this->renderTag('input', array('type' => 'checkbox', 'name' => $name.'[is_empty]', 'checked' => $values['is_empty'] ? 'checked' : '')) : '', 60 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this-> getOption('empty_label'), array('for' => $this->generateId($name.'[is_empty]'))) : '',60 '%empty_label%' => $this->getOption('with_empty') ? $this->renderContentTag('label', $this->translate($this->getOption('empty_label')), array('for' => $this->generateId($name.'[is_empty]'))) : '', 61 61 )); 62 62 } branches/1.4/lib/widget/sfWidgetFormInputFileEditable.class.php
r22869 r24015 4 4 * This file is part of the symfony package. 5 5 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 85 85 86 86 $delete = $this->renderTag('input', array_merge(array('type' => 'checkbox', 'name' => $deleteName), $attributes)); 87 $deleteLabel = $this->renderContentTag('label', $this->getOption('delete_label'), array_merge(array('for' => $this->generateId($deleteName)))); 87 $deleteLabel = $this->translate($this->getOption('delete_label')); 88 $deleteLabel = $this->renderContentTag('label', $deleteLabel, array_merge(array('for' => $this->generateId($deleteName)))); 88 89 } 89 90 else branches/1.4/test/unit/widget/sfWidgetFormInputFileEditableTest.php
r19531 r24015 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(6); 13 class FormFormatterStub extends sfWidgetFormSchemaFormatter 14 { 15 public function __construct() {} 16 17 public function translate($subject, $parameters = array()) 18 { 19 return sprintf('translation[%s]', $subject); 20 } 21 } 22 23 $t = new lime_test(7); 14 24 15 25 // ->render() … … 46 56 $t->is($w->render('foo'), '-foo-<br /><input type="file" name="foo" id="foo" /><br /><input type="checkbox" name="foo_delete" id="foo_delete" /> <label for="foo_delete">delete</label>', '->render() renders the widget as HTML'); 47 57 58 $t->diag('delete label translation'); 59 $ws = new sfWidgetFormSchema(); 60 $ws->addFormFormatter('stub', new FormFormatterStub()); 61 $ws->setFormFormatterName('stub'); 62 $w = new sfWidgetFormInputFileEditable(array( 63 'file_src' => '-foo-', 64 )); 65 $w->setParent($ws); 66 $t->is($w->render('foo'), '-foo-<br /><input type="file" name="foo" id="foo" /><br /><input type="checkbox" name="foo_delete" id="foo_delete" /> <label for="foo_delete">translation[remove the current file]</label>', '->render() renders the widget as HTML'); 67 48 68 $t->diag('is_image option'); 49 69 $w = new sfWidgetFormInputFileEditable(array(