Development

Changeset 24015

You must first sign up to be able to contribute.

Changeset 24015

Show
Ignore:
Timestamp:
11/16/09 14:33:34 (3 years ago)
Author:
bschussek
Message:

[1.3, 1.4] Static texts in native widgets are translated by default (fixes #7590, patch by FabienP)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml

    r13399 r24015  
    122122        <target>Das Objekt wurde erfolgreich gelöscht.</target> 
    123123      </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> 
    124148    </body> 
    125149  </file> 
  • branches/1.3/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml

    r20548 r24015  
    146146        <target>Un problème est survenu lors de la suppression des objets sélectionnés.</target> 
    147147      </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> 
    148172    </body> 
    149173  </file> 
  • branches/1.3/lib/widget/sfWidgetFormDateRange.class.php

    r12873 r24015  
    5656    $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); 
    5757 
    58     return strtr($this->getOption('template'), array( 
     58    return strtr($this->translate($this->getOption('template')), array( 
    5959      '%from_date%'      => $this->getOption('from_date')->render($name.'[from]', $value['from']), 
    6060      '%to_date%'        => $this->getOption('to_date')->render($name.'[to]', $value['to']), 
  • branches/1.3/lib/widget/sfWidgetFormFilterDate.class.php

    r19243 r24015  
    44 * This file is part of the symfony package. 
    55 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    6363      '%date_range%'     => parent::render($name, $value, $attributes, $errors), 
    6464      '%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]'))) : '', 
    6666    )); 
    6767  } 
  • branches/1.3/lib/widget/sfWidgetFormFilterInput.class.php

    r13510 r24015  
    5858      '%input%'          => $this->renderTag('input', array_merge(array('type' => 'text', 'id' => $this->generateId($name), 'name' => $name.'[text]', 'value' => $values['text']), $attributes)), 
    5959      '%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]'))) : '', 
    6161    )); 
    6262  } 
  • branches/1.3/lib/widget/sfWidgetFormInputFileEditable.class.php

    r22869 r24015  
    44 * This file is part of the symfony package. 
    55 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    8585 
    8686      $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)))); 
    8889    } 
    8990    else 
  • branches/1.3/test/unit/widget/sfWidgetFormInputFileEditableTest.php

    r19531 r24015  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(6); 
     13class 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); 
    1424 
    1525// ->render() 
     
    4656$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'); 
    4757 
     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 
    4868$t->diag('is_image option'); 
    4969$w = new sfWidgetFormInputFileEditable(array( 
  • branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.de.xml

    r13399 r24015  
    122122        <target>Das Objekt wurde erfolgreich gelöscht.</target> 
    123123      </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> 
    124148    </body> 
    125149  </file> 
  • branches/1.4/lib/plugins/sfPropelPlugin/i18n/sf_admin.fr.xml

    r20548 r24015  
    146146        <target>Un problème est survenu lors de la suppression des objets sélectionnés.</target> 
    147147      </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> 
    148172    </body> 
    149173  </file> 
  • branches/1.4/lib/widget/sfWidgetFormDateRange.class.php

    r12873 r24015  
    5656    $values = array_merge(array('from' => '', 'to' => '', 'is_empty' => ''), is_array($value) ? $value : array()); 
    5757 
    58     return strtr($this->getOption('template'), array( 
     58    return strtr($this->translate($this->getOption('template')), array( 
    5959      '%from_date%'      => $this->getOption('from_date')->render($name.'[from]', $value['from']), 
    6060      '%to_date%'        => $this->getOption('to_date')->render($name.'[to]', $value['to']), 
  • branches/1.4/lib/widget/sfWidgetFormFilterDate.class.php

    r19243 r24015  
    44 * This file is part of the symfony package. 
    55 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    6363      '%date_range%'     => parent::render($name, $value, $attributes, $errors), 
    6464      '%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]'))) : '', 
    6666    )); 
    6767  } 
  • branches/1.4/lib/widget/sfWidgetFormFilterInput.class.php

    r13510 r24015  
    5858      '%input%'          => $this->renderTag('input', array_merge(array('type' => 'text', 'id' => $this->generateId($name), 'name' => $name.'[text]', 'value' => $values['text']), $attributes)), 
    5959      '%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]'))) : '', 
    6161    )); 
    6262  } 
  • branches/1.4/lib/widget/sfWidgetFormInputFileEditable.class.php

    r22869 r24015  
    44 * This file is part of the symfony package. 
    55 * (c) Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    8585 
    8686      $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)))); 
    8889    } 
    8990    else 
  • branches/1.4/test/unit/widget/sfWidgetFormInputFileEditableTest.php

    r19531 r24015  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(6); 
     13class 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); 
    1424 
    1525// ->render() 
     
    4656$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'); 
    4757 
     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 
    4868$t->diag('is_image option'); 
    4969$w = new sfWidgetFormInputFileEditable(array(