Skip to content

Commit

Permalink
[FrameworkBundle] added support for double-quoted strings in the extr…
Browse files Browse the repository at this point in the history
…actor (closes #8797)
  • Loading branch information
fabpot committed Aug 28, 2013
1 parent 16b585d commit 4922a80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
@@ -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") ?>
Expand Up @@ -28,8 +28,9 @@ public function testExtraction()
$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');
}
}
Expand Up @@ -111,7 +111,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog)
}
}

$message = trim($message, '\'');
$message = trim($message, '\'"');

if ($message) {
$catalog->set($message, $this->prefix.$message);
Expand Down

0 comments on commit 4922a80

Please sign in to comment.