Skip to content

Commit

Permalink
moved integration between the Translation component and Twig to a Sym…
Browse files Browse the repository at this point in the history
…fony Bridge
  • Loading branch information
fabpot committed Mar 23, 2011
1 parent 3e5bd67 commit e912b34
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
Expand Up @@ -9,19 +9,20 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\Extension;
namespace Symfony\Bridge\Twig\Extension;

use Symfony\Bundle\TwigBundle\TokenParser\TransTokenParser;
use Symfony\Bundle\TwigBundle\TokenParser\TransChoiceTokenParser;
use Symfony\Bridge\Twig\TokenParser\TransTokenParser;
use Symfony\Bridge\Twig\TokenParser\TransChoiceTokenParser;
use Symfony\Component\Translation\TranslatorInterface;

/**
* Provides integration of the Translation component with Twig.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TransExtension extends \Twig_Extension
{
protected $translator;
private $translator;

public function __construct(TranslatorInterface $translator)
{
Expand Down
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\Node;
namespace Symfony\Bridge\Twig\Node;

/**
*
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\TokenParser;
namespace Symfony\Bridge\Twig\TokenParser;

use Symfony\Bundle\TwigBundle\Node\TransNode;
use Symfony\Bridge\Twig\Node\TransNode;

/**
*
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\TokenParser;
namespace Symfony\Bridge\Twig\TokenParser;

use Symfony\Bundle\TwigBundle\Node\TransNode;
use Symfony\Bridge\Twig\Node\TransNode;

/**
*
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\Bundle\TwigBundle\Extension\TransExtension" public="false">
<service id="twig.extension.trans" class="Symfony\Bridge\Twig\Extension\TransExtension" public="false">
<tag name="twig.extension" />
<argument type="service" id="translator" />
</service>
Expand Down
22 changes: 22 additions & 0 deletions tests/Symfony/Tests/Bridge/Twig/TestCase.php
@@ -0,0 +1,22 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Bridge\Twig;

class TestCase extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
}
}
Expand Up @@ -9,15 +9,21 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\Tests;
namespace Symfony\Tests\Bridge\Twig;

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

class TransTest extends TestCase
{
protected function setUp()
{
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
}

/**
* @dataProvider getTransTests
*/
Expand Down

0 comments on commit e912b34

Please sign in to comment.