-
Notifications
You must be signed in to change notification settings - Fork 32
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
Not parse twig files #5
Comments
Hi, thanks for using Twig Gettext Extractor! Can you please run command from "Poedit error message", and post the output. |
Please run that gettext command and paste text output instead of image screenshots, use markdown. |
sh-3.2# /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot" --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP --files "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-forms.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-header.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-image-uploader.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-item-meta.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-links-header.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-message.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-meta.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-uploaded-files.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-uploaded-images.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-uploader-file.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend-uploader-image.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/backend.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/frontend-links-header.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/frontend-meta.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/frontend.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/abstracts/tpl-tabs.twig" xgettext: невозможно создать файл вывода "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot": No such file or directory Fatal error: Uncaught exception 'RuntimeException' with message 'Gettext command "xgettext --sort-output --force-po -o /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d48 in /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/umpirsky/twig-gettext-extractor/Twig/Gettext/Extractor.php on line 79 |
No, not that command, run command that is reported to fail in error message |
sh-3.2# xgettext --sort-output --force-po -o /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d4851d4ed/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/5113d48 xgettext: ошибка открытия файла "/tmp/cache/5113d48" для чтения: No such file or directory |
Command is cat, hehumm. According to this message Is your Poedit configured to use this pot file? Do you have it? You can try to run same command witout last cutted path. |
Poedit work perfectly with PHP code and generate/read/write .pot and .po and .mo files and when He try also parse twig after php He answered error. The .../17extracted.pot file generate by your extractor and i have /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/ but have not poeditaOSeOc/17extracted.pot |
I would like you to show me the piece of code in Twig Gettext Extractor where It is not generated by Twig Gettext Extractor, but by Poedit. Can you give me your parser command from Poedit preferences? Also, try t run it on fewer twig templates, for example 2 or 3. Looks like command is too long and is cutted. Then paste output again. |
Run with few templates: sh-3.2# /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot" --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP --files "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-default.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-edit.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-front-menu.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-menu.twig" xgettext: невозможно создать файл вывода "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot": No such file or directory Fatal error: Uncaught exception 'RuntimeException' with message 'Gettext command "xgettext --sort-output --force-po -o /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php" failed with error code 1 and output: ' in /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/umpirsky/twig-gettext-extractor/Twig/Gettext/Extractor.php:79 Stack trace: #0 /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/umpirsky/twig-gettext-extractor/twig-gettext-extractor(58): Twig\Gettext\Extractor->extract() #1 {main} thrown in /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/umpirsky/twig-gettext-extractor/Twig/Gettext/Extractor.php on line 79 |
OK, and when you run:
? |
In errors in my post i see that file ...IZ5x/0extracted.pot not created, than i try to change path to file and run again: sh-3.2# /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/0extracted.pot" --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP --files "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-default.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-edit.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-front-menu.twig" "/Users/noon-ehos/work/sources/vnmu.loc/views/profile/profile-menu.twig" sh-3.2# And i have no errors, and 0extracted.pot was created in /var/folders/ and i have next body of file: # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-02-14 13:02+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" |
if I run your last command, it's look like this: sh-3.2# xgettext --sort-output --force-po -o /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php xgettext: невозможно создать файл вывода "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot": No such file or directory |
Change |
my Parser command: /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F |
From #5 (comment) change |
sh-3.2# xgettext --sort-output --force-po -o Users/noon-ehos/work/sources/vnmu.loc/languages/messages.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php xgettext: невозможно создать файл вывода "Users/noon-ehos/work/sources/vnmu.loc/languages/messages.pot": No such file or directory but this file alredy exist and have maybe 400 lines with phrases |
Sorry, I was run it as local path without first "/" sh-3.2# xgettext --sort-output --force-po -o /Users/noon-ehos/work/sources/vnmu.loc/languages/messages.pot --from-code=UTF-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php sh-3.2# |
and now my pot file look like: # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-02-14 13:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" |
but old file was have much more data |
I was try to see what I have in /tmp/cache/511cc30159f39/f0/9d/e8ec729d8f0c5a034863632073d1.php and it's standart twig=>php cache but without some _() or gettext() functions and without phrases, so i was try see other cache files and understand that it is the same file repited 5 times in command :( |
I can find some time to debug this during the weekend. Can you create a test repo on github so we can debug? |
Ok, i will create repo and post url here in few hours |
Perfect, thanks! |
https://github.com/noon-ehos/potest.loc I add you as collaborator. |
👍 |
You missed composer.json, and extractor dependency in it :) |
Please try this, it worked for me:
Now open messages.po with Poedit, and update from sources, you should get |
OS X Mountain lion, Latest Poedit
|
Why it does not work now? :) If you really gave it 777, it should look like:
|
Yes it look like: drwxrwxrwx 8 root wheel 272 Feb 14 20:02 folders ..... For project |
But have same error |
And |
this file not created on run from Poedit |
So it is created when you click to update from sources? Maybe it gives him wrong privileges. Try to chmod it from vendor/bin/twig-gettext-extractor , it is in |
I test it another method. I change parder command %o to my project folder where I have all in 777 and POedit can't create file in this folder too :( Невозможно выполнить программу: /Users/noon-ehos/work/sources/potest.loc/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/Users/noon-ehos/work/sources/potest.loc/meess.pot" --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP --files "twig/test.twg" |
but command from error message work from terminal without sudo. %( ????? |
No idea, like your Poedit have some kind of sandbox and run extractor with limited privileges :P Try to add sudo to command, just curious https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/Twig/Gettext/Extractor.php#L72 |
Poedit error: sudo: no tty present and no askpass program specified I think that poedit can't run correct twig-gettex-textractor througth PHP |
I set exit(); in first lines your twig-gettex-textractor and error from poedit has no changes |
If you want to debug it, log to files. |
command "system" not working Extractor.php: public function extract() { $command = 'xgettext'; $command .= ' '.join(' ', $this->parameters); $command .= ' '.join(' ', $this->templates); $error = 0; $output = system($command, $error); fprint_xarray("log.txt",$error); // == 127 if (0 !== $error) { throw new \RuntimeException(sprintf( 'Gettext command "%s" failed with error code %s and output: %s', $command, $error, $output )); } $this->reset(); } |
safe_mode in php.ini and in phpinfo() set as Off |
run: ... $error = 0; $output = system($command, $error); fprint_xarray("log.txt",array($command,$output,$error)); ... Give me in file: Array ( [0] => xgettext --sort-output --force-po -o /Users/noon-ehos/work/sources/potest.loc/meess.pot --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP /tmp/cache/511e4af426cb7/9c/6d/d091dface6809a09565f5cf45742.php [1] => [2] => 127 ) |
I finde that Extractor.php give /tmp/cache/511e4af426cb7/ dir name to system() function but atthe same time in File system was createt another tmp dir /tmp/cache/511e444864c8c/ |
no it was fail. names of dirs the same |
all the same but function system() in extractor return false; |
create some small test. I run code show me: string(0) "" int(127) And show me: PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies string(61) "Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies" int(0) If i run xgettext --version in terminal without sudo I see good answer with current version |
Can you try with |
I try system, exec and passthru result: error - 127 |
I complete IT! 🎱 Problem for me was in system() function I need to set full path to xgettext tool now it look: $command = '/opt/local/bin/xgettext'; $command .= ' '.join(' ', $this->parameters); $command .= ' '.join(' ', $this->templates); $error = 0; $output = system($command, $error); I try it before but I serch it with terminal tool $ whereis xgettextand have resalt /usr/bin/gettextWhen i use command $ which xgettextI have resalt /opt/local/bin/xgettext So I recommend to create some config var for path to xgettext in your tool |
On my system it is:
Maybe we can do |
yes it's great idea but windows os? :) |
Hehe, we can leave current behavior for windows or if if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') If you can fix PR for this, it would be awesome. |
PR, I mean pull request :) |
ok, will try, it will be my first fork |
No worries, I will help you, thanks! |
Bad news, in my case system("which xgettext") not work too. And for example system("which php") work perfectly. In terminal both work perfect without sudo. Not understand what it can be... |
Poedit error message:
How I install Extractor in terminal:
The text was updated successfully, but these errors were encountered: