umpirsky / Twig-Gettext-Extractor

The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.
MIT License
113 stars 32 forks source link

Cannot execute program | Linux #27

Closed superhero closed 9 years ago

superhero commented 9 years ago

I saw this issue #13, but it touches the issue in a windows enviroment. Mine is similer, but on Ubuntu 14.10

Poedit casts the following error:

Cannot execute program: /home/erik/NetBeansProjects/twig-gettext-extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/tmp/poediteiPP9M/10extracted.pot" --from-code=UTF-8  -k__ -k_e -k_x -L PHP --files  "views/404.twig" "views/admin/global-segment.twig" "views/layout/home-users.twig" "views/page.twig" "views/partial/comments.twig" "views/partial/contact-menu.twig" "views/partial/customer-service.twig" "views/partial/flash-messages.twig" "views/partial/form-map.twig" "views/partial/menu-blog-posts.twig" "views/partial/order/coverage-search-required.twig" "views/partial/quick-contact.twig" "views/partial/services.twig" "views/partial/share.twig" "views/single-post.twig" "views/single-service.twig"

Running twig-gettext-extractor

PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Gettext command "xgettext  " failed with error code 1 and output: ' in /home/erik/NetBeansProjects/twig-gettext-extractor/vendor/umpirsky/twig-gettext-extractor/Twig/Gettext/Extractor.php:79
Stack trace:
#0 /home/erik/NetBeansProjects/twig-gettext-extractor/vendor/umpirsky/twig-gettext-extractor/twig-gettext-extractor(58): Twig\Gettext\Extractor->extract()
#1 {main}
  thrown in /home/erik/NetBeansProjects/twig-gettext-extractor/vendor/umpirsky/twig-gettext-extractor/Twig/Gettext/Extractor.php on line 79

Looked over the installation settings, confirming I'm using recomended settings.

superhero commented 9 years ago

So the issue seems to be the xgettext command, with the lack of arguments I guess. Using Poedit version: 1.7.5

umpirsky commented 9 years ago

@erik-landvall Hi, thanks for reporting.

Can you log command in https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/Twig/Gettext/Extractor.php#L77 and then run what you find in logs from command line?

superhero commented 9 years ago

Sorry for not being active, I have a stressed deadline for the moment.

The command is already being logged though: https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/Twig/Gettext/Extractor.php#L81

As you can see it's a part of the runtime exception message: xgettext. If I run that command in the terminal I simply get the response that the arguments are missing:

$ xgettext
xgettext: no input file given
Try 'xgettext --help' for more information.
umpirsky commented 9 years ago

Looks like parameters and templates are empty in https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/Twig/Gettext/Extractor.php#L73-L74. Can you debug?

superhero commented 9 years ago

yes, but not until this project is packed and shipped later this week :)

umpirsky commented 9 years ago

:)

superhero commented 9 years ago

sorry @umpirsky I had to go different path to solve the issue due to a pressed time table. I wont be able to help debugging this as it looks now. If someone else has a problem with this, they will have to pick up where I left :)

umpirsky commented 9 years ago

@erik-landvall OK, thanks for the info. I didn't use this tool for quite some time, will try to test it soon to see if it works as expected still.

umpirsky commented 9 years ago

Just tested it on Linux, it worked. I released version 1.2.0. If you still have any problems feel free to reopen. Thanks.