Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown "__" function #33

Closed
dweipert-3138720606 opened this issue Apr 7, 2016 · 1 comment
Closed

Unknown "__" function #33

dweipert-3138720606 opened this issue Apr 7, 2016 · 1 comment

Comments

@dweipert-3138720606
Copy link

I just discovered that poedit can't parse my twig files and immediately found your extractor!

I installed it like in your global approach:
$ sudo wget https://github.com/umpirsky/Twig-Gettext-Extractor/releases/download/1.2.0/twig-gettext-extractor.phar -O /usr/local/bin/twig-gettext-extractor
$ sudo chmod a+x /usr/local/bin/twig-gettext-extractor

But my poedit can't execute the given command from your setup.

Cannot execute program: twig-gettext-extractor --sort-output --force-po -o "/tmp/poeditWdeTGk/2extracted.pot" --from-code=UTF-8 -k__ -k_e -k_n:1,2 -k_x:1,2c -k_ex:1,2c -L PHP --files "menu/views/settings.twig" "post-type/views/archive.twig"

When navigating to my project folder and executing the command manually I get:
PHP Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unknown "__" function in "/home/dweipert/PhpstormProjects/dealer-search/code-plugin-dealer-search/menu/views/settings.twig" at line 1.' in phar:///usr/local/bin/twig-gettext-extractor/vendor/twig/twig/lib/Twig/ExpressionParser.php:573

But I defined "__" and some more WordPress specific functions as keywords for my catalog.

@umpirsky
Copy link
Owner

umpirsky commented Apr 7, 2016

@DRogue1337 You should define custom extensions like documented in https://github.com/umpirsky/Twig-Gettext-Extractor#custom-extensions.

__ is not available by default in twig.

Feel free to reopen if this does not fixes your issue.

@umpirsky umpirsky closed this as completed Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants