PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Dev.Umpirsky.com: Use Poedit to Extract Translations from Twig Templates

Note: This article was originally published at PHPDeveloper on 5 September 2012.
PHPDeveloper

In this new post to the Umpirsky.com development blog, they show you how to use poedit to extract translations from Twig templates.

By default, Poedit does not have the ability to parse Twig templates. In Twig documenation there is a simple example which shows how to extract translations. This can work with few modifications, but I wanted to make reusable tool which will allow you to parse Twig templates just like you do with plain PHP templates.

The result is the Twig-Gettext-Extractor that's set up inside Poedit as a parser command for "*.twig" files. This automatically extracts the information so that the editor can read the data from the template.