W3cubDocs

/Symfony 4.1

TwigExtractor

class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface

TwigExtractor extracts translation messages from a twig template.

Methods

array extractFiles(string|array $resource) from AbstractFileExtractor
bool isFile(string $file) from AbstractFileExtractor
bool canBeExtracted(string $file)
array extractFromDirectory(string|array $directory)
__construct(Environment $twig)
extract(string|array $resource, MessageCatalogue $catalogue)

Extracts translation messages from files, a file or a directory to the catalogue.

setPrefix(string $prefix)

Sets the prefix that should be used for new found messages.

extractTemplate($template, MessageCatalogue $catalogue)

Details

protected array extractFiles(string|array $resource)

Parameters

string|array $resource Files, a file or a directory

Return Value

array

protected bool isFile(string $file)

Parameters

string $file

Return Value

bool

Exceptions

InvalidArgumentException

protected bool canBeExtracted(string $file)

Parameters

string $file

Return Value

bool

protected array extractFromDirectory(string|array $directory)

Parameters

string|array $directory

Return Value

array files to be extracted

__construct(Environment $twig)

Parameters

Environment $twig

extract(string|array $resource, MessageCatalogue $catalogue)

Extracts translation messages from files, a file or a directory to the catalogue.

Parameters

string|array $resource Files, a file or a directory
MessageCatalogue $catalogue The catalogue

setPrefix(string $prefix)

Sets the prefix that should be used for new found messages.

Parameters

string $prefix The prefix

protected extractTemplate($template, MessageCatalogue $catalogue)

Parameters

$template
MessageCatalogue $catalogue

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bridge/Twig/Translation/TwigExtractor.html