As you mentioned – it’s an open issue so unlikely to have been resolved by any of the solutions in the thread… This seems to be the most likely working solution though
wp timber make-pot && wp i18n make-pot --merge=twig.pot
I haven’t used timber before but check what file is created with wp timber make-pot
and ensure that’s the one merged into the i18n
command
The other code examples refer to improvements in the i18n-command
package itself
Edit
Looking at the ticket again this is actually just another “suggested” use case. But there’s still hope…
According to this page on the timber GitHub support there are a few options available to you.
- Use a tool that supports parsing Twig files to detect all your translations like Poedit. This will make your
.pot
files and the merge command can be run to work it into thei18n
function. - A nasty twig vs. gettext hack is to add
{#<?php#}
to the top of your twig files. By doing this, gettext will interpret whatever comes next as PHP, and start looking for__
. - Twig gettext extractor – a special Twig parser for Poedit.
- There is mention of a gulp script to do this… however the links I followed don’t seem to work any more – this is the original ticket for the gulp solution though and can be used as a base if you feel like having a crack at that