Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ matrix:
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"

install:
- travis_retry composer update --prefer-dist --no-interaction
- travis_retry composer update --prefer-dist --no-interaction $COMPOSER_FLAGS

script:
- $TEST_COMMAND
Expand Down
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

## UNRELEASED

## 1.1.1

### Fixed

- Make sure we test with the lowest version on Travis
- Fixed minor bugs for Twig 1.x.

## 1.1.0

### Added
Expand Down
5 changes: 5 additions & 0 deletions src/FileExtractor/TwigFileExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public function getNodeVisitors()
{
return $this->visitors;
}

public function getName()
{
return 'php.translation';
}
}
2 changes: 2 additions & 0 deletions src/Visitor/Twig/TranslationBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Translation\Extractor\Visitor\Twig;

use Symfony\Bridge\Twig\Node\TransNode;
use Translation\Extractor\Model\SourceLocation;
use Translation\Extractor\Visitor\BaseVisitor;
use Twig_Environment;
use Twig_NodeInterface;
Expand Down
1 change: 1 addition & 0 deletions src/Visitor/Twig/TranslationFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Translation\Extractor\Visitor\Twig;

use Translation\Extractor\Model\SourceLocation;
use Translation\Extractor\Visitor\BaseVisitor;
use Twig_Environment;
use Twig_NodeInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Visitor/Twig/TwigVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(Worker $worker = null)
*/
public static function create()
{
if (\Twig_Environment::MAJOR_VERSION === 1) {
if (-1 === version_compare(\Twig_Environment::VERSION, '2.0')) {
return new Twig1Visitor();
}

Expand Down
7 changes: 6 additions & 1 deletion src/Visitor/Twig/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ public function work($node, SourceCollection $collection, callable $getAbsoluteF
));
} elseif ($node instanceof TransNode) {
// extract trans nodes
$domain = self::UNDEFINED_DOMAIN;
if ($node->hasNode('domain') && null !== $node->getNode('domain')) {
$domain = $this->getReadDomainFromNode($node->getNode('domain'));
}

$collection->addLocation(new SourceLocation(
$node->getNode('body')->getAttribute('data'),
$getAbsoluteFilePath(),
$node->getTemplateLine(),
['domain' => $node->hasNode('domain') ? $this->getReadDomainFromNode($node->getNode('domain')) : self::UNDEFINED_DOMAIN]
['domain' => $domain]
));
}

Expand Down