Skip to content

Commit

Permalink
renamed Twig TransExtension to TranslationExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 28, 2011
1 parent 3bf6736 commit faf9782
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Expand Up @@ -20,7 +20,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TransExtension extends \Twig_Extension
class TranslationExtension extends \Twig_Extension
{
private $translator;

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml
Expand Up @@ -33,7 +33,7 @@
<argument type="service" id="templating.globals" />
</service>

<service id="twig.extension.trans" class="Symfony\Bridge\Twig\Extension\TransExtension" public="false">
<service id="twig.extension.trans" class="Symfony\Bridge\Twig\Extension\TranslationExtension" public="false">
<tag name="twig.extension" />
<argument type="service" id="translator" />
</service>
Expand Down
Expand Up @@ -9,13 +9,14 @@
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Bridge\Twig;
namespace Symfony\Tests\Bridge\Twig\Extension;

use Symfony\Bridge\Twig\Extension\TransExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Tests\Bridge\Twig\TestCase;

class TransTest extends TestCase
class TranslationExtensionTest extends TestCase
{
protected function setUp()
{
Expand All @@ -33,7 +34,7 @@ public function testTrans($template, $expected, array $variables = array())
print $template."\n";
$loader = new \Twig_Loader_Array(array('index' => $template));
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
$twig->addExtension(new TransExtension(new Translator('en', new MessageSelector())));
$twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector())));

echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSource('index'), 'index')))."\n\n";
$this->assertEquals($expected, $this->getTemplate($template)->render($variables));
Expand Down Expand Up @@ -84,7 +85,7 @@ protected function getTemplate($template)
{
$loader = new \Twig_Loader_Array(array('index' => $template));
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
$twig->addExtension(new TransExtension(new Translator('en', new MessageSelector())));
$twig->addExtension(new TranslationExtension(new Translator('en', new MessageSelector())));

return $twig->loadTemplate('index');
}
Expand Down

0 comments on commit faf9782

Please sign in to comment.