Zend Framework 2 Twig Translate

I am using Zend Framework 2.3.1 with Twig as my template engine and ZfTwig extension.

I want to use Twig translation syntax, but with a Zend translator, so PoEdit can parse it.

Is there a (simple) way to implement my ideas? Thanks in advance!

+4
source share
1 answer

When you use Twig as a template engine, you will process the files .twig, not .phtml. Twig files have different syntax from PHP files, and by default Poedit is not able to parse branch patterns.

Poedit, Twig , PHP. Twig-Gettext-Extractor. . Poedit, Twig.

:

<project>/vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F

Poedit, Edit > Preferences > Parsers :

enter image description here

:

./twig-gettext-extractor --sort-output --force-po -o messages.po -L PHP --files file1.twig file2.twig fileN.twig

, Poedit .

Twig Gettext Extractor README Github.

, .

0

All Articles