[TwigBridge] fixed the translator extractor that were not trimming the text in trans tags (closes #7056)
Trimming was not done by the extractor but it was the default behavior of the TransNode class. Now, things are consistent between the two.
This commit is contained in:
parent
d10ad0f9e7
commit
83382bc798
@ -63,6 +63,7 @@ class TwigExtractorTest extends TestCase
|
||||
array('{{ "new key" | transchoice(1) | upper }}', array('new key' => 'messages')),
|
||||
array('{{ "new key" | transchoice(1, {}, "domain") }}', array('new key' => 'domain')),
|
||||
array('{% trans %}new key{% endtrans %}', array('new key' => 'messages')),
|
||||
array('{% trans %} new key {% endtrans %}', array('new key' => 'messages')),
|
||||
array('{% trans from "domain" %}new key{% endtrans %}', array('new key' => 'domain')),
|
||||
array('{% set foo = "new key" | trans %}', array('new key' => 'messages')),
|
||||
array('{{ 1 ? "new key" | trans : "another key" | trans }}', array('new key' => 'messages', 'another key' => 'messages')),
|
||||
|
@ -77,7 +77,7 @@ class TwigExtractor implements ExtractorInterface
|
||||
$this->twig->parse($this->twig->tokenize($template));
|
||||
|
||||
foreach ($visitor->getMessages() as $message) {
|
||||
$catalogue->set($message[0], $this->prefix.$message[0], $message[1] ? $message[1] : $this->defaultDomain);
|
||||
$catalogue->set(trim($message[0]), $this->prefix.trim($message[0]), $message[1] ? $message[1] : $this->defaultDomain);
|
||||
}
|
||||
|
||||
$visitor->disable();
|
||||
|
Reference in New Issue
Block a user