natxet / twig-po
Extract {%trans%} keys from twig and insert them in your PO file
Installs: 2 055
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 3
Open Issues: 2
Requires
- symfony/console: 2.3.*@dev
This package is auto-updated.
Last update: 2024-11-24 04:27:00 UTC
README
Extract translation keys from twig templates and move them to PO
Instructions
Fork and install (you need composer for that!):
git clone git@github.com:natxet/twig-po.git
cd twig-po
composer install
Then, go to folder and execute:
./console find:tags /path/to/twig/templates /path/to/messages.po Po -d -v -o
Once you see that nothing wrong is going to happen then
./console find:tags /path/to/twig/templates /path/to/messages.po Po
If you want to use it with other tags, for instance, for your PHP files with _('translation')
./console find:tags /path/to/twig/templates /path/to/messages.po Po -t "/_\((?: )?['\"]([^$]*)['\"](?: )?\)/muU"
For help:
./console help find:tags
Once you have the PO translated, convert to .mo with your editor or command line:
msgfmt -cv -o messages.mo messages.po
(Note: you need to have gettext installed for this command)