Download the PHP package umpirsky/twig-gettext-extractor without Composer
On this page you can find all versions of the php package umpirsky/twig-gettext-extractor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download umpirsky/twig-gettext-extractor
More information about umpirsky/twig-gettext-extractor
Files in umpirsky/twig-gettext-extractor
Package twig-gettext-extractor
Short Description The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.
License MIT
Informations about the package twig-gettext-extractor
symfony upgrade fixer • twig gettext extractor • wisdom • centipede • permissions handler • extraload • gravatar • locurro • country list • transliterator
Twig Gettext Extractor
The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.
Installation
Manual
Local
Download the twig-gettext-extractor.phar
file and store it somewhere on your computer.
Global
You can run these commands to easily access twig-gettext-extractor
from anywhere on
your system:
Then, just run twig-gettext-extractor
.
Composer
Local
Global
Make sure you have ~/.composer/vendor/bin
in your PATH
and
you're good to go:
Don't forget to add this line in your .bashrc
file if you want to keep this change after reboot.
Setup
By default, Poedit does not have the ability to parse Twig templates. This can be resolved by adding an additional parser (Edit > Preferences > Parsers) with the following options:
- Language:
Twig
- List of extensions:
*.twig
- Invocation:
- Parser command:
<project>/vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F
(replace<project>
with absolute path to your project) - An item in keyword list:
-k%k
- An item in input file list:
%f
- Source code charset:
--from-code=%c
- Parser command:
Now you can update your catalog and Poedit will synchronize it with your twig templates.
Custom extensions
Twig-Gettext-Extractor registers some default twig extensions. However, if you are using custom extensions, you need to register them first before you can extract the data. In order to achieve that, copy the binfile into some custom place. A common practice would be: cp vendor/bin/twig-gettext-extractor bin/twig-gettext-extractor
Now you may add your custom extensions here:
Command Line Arguments
You can also specify custom extensions and filters via command line, by adding the --functions and --filters arguments, e.g.:
You can specify an unlimited amount of comma-separated function and filter names.
Similarly, you can specify the location of the gettext executable you want to use with --exec
All versions of twig-gettext-extractor with dependencies
twig/twig Version ^2.0
twig/extensions Version ~1.0
symfony/twig-bridge Version ^4.0
symfony/routing Version ^4.0
symfony/filesystem Version ^4.0
symfony/translation Version ^4.0
symfony/form Version ^4.0
symfony/asset Version ^4.0