[FrameworkBundle] added support for double-quoted strings in the extractor (closes #8797)
This commit is contained in:
parent
16b585dc6a
commit
4922a80ee5
@ -1,2 +1,3 @@
|
||||
This template is used for translation message extraction tests
|
||||
<?php echo $view['translator']->trans('new key') ?>
|
||||
<?php echo $view['translator']->trans('single-quoted key') ?>
|
||||
<?php echo $view['translator']->trans("double-quoted key") ?>
|
||||
|
@ -28,8 +28,9 @@ class PhpExtractorTest extends TestCase
|
||||
$extractor->extract(__DIR__.'/../Fixtures/Resources/views/', $catalogue);
|
||||
|
||||
// Assert
|
||||
$this->assertCount(1, $catalogue->all('messages'), '->extract() should find 1 translation');
|
||||
$this->assertTrue($catalogue->has('new key'), '->extract() should find at leat "new key" message');
|
||||
$this->assertEquals('prefixnew key', $catalogue->get('new key'), '->extract() should apply "prefix" as prefix');
|
||||
$this->assertCount(2, $catalogue->all('messages'), '->extract() should find 1 translation');
|
||||
$this->assertTrue($catalogue->has('single-quoted key'), '->extract() should find the "single-quoted key" message');
|
||||
$this->assertTrue($catalogue->has('double-quoted key'), '->extract() should find the "double-quoted key" message');
|
||||
$this->assertEquals('prefixsingle-quoted key', $catalogue->get('single-quoted key'), '->extract() should apply "prefix" as prefix');
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class PhpExtractor implements ExtractorInterface
|
||||
}
|
||||
}
|
||||
|
||||
$message = trim($message, '\'');
|
||||
$message = trim($message, '\'"');
|
||||
|
||||
if ($message) {
|
||||
$catalog->set($message, $this->prefix.$message);
|
||||
|
Reference in New Issue
Block a user