Search code examples
phptwigtwig-extension

Twig extract tranlations not working


Am trying to extract PO files with using twig i18 extension. Following this tutorial http://twig.sensiolabs.org/doc/extensions/i18n.html i try to translate my site.

Problem is when i try to extract translations when i call in terminal:

root@debian:/var/www/html# xgettext --default-domain=messages -p ./locale --from-code=UTF-8 -n --omit-header -L PHP ./cache/*.php
xgettext: error while opening "./cache/*.php" for reading: No such file or directory

Check screenshot: enter image description here

Checkig $ xgettext --help i dont see -R recursive search


Solution

  • It's trying to call "./cache/*.php" but your files are in subfolders, within the cache folder, so it should be "./cache/**/*.php".

    This command should work, I guess:

    root@debian:/var/www/html# xgettext --default-domain=messages -p ./locale --from-code=UTF-8 -n --omit-header -L PHP ./cache/**/*.php