Open oleksandr-diudiun opened 11 years ago
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 xgettext --sort-output --force-po ...
.
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 xgettext: невозможно создать файл вывода "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot": No such file or directory
looks like this pot file is missing.
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 17extracted.pot
is being generated.
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:
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
?
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 /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot
to pont to your .pot file and run again.
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 https://github.com/umpirsky/Twig-Gettext-Extractor/issues/5#issuecomment-13542870 change /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot
to pont to your .pot file and run again.
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 "/" So true resalt is:
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.
:thumbsup:
You missed composer.json, and extractor dependency in it :)
Please try this, it worked for me:
$ git clone git@github.com:noon-ehos/potest.loc.git (or pull)
$ cd potest.loc
$ composer install
Now open messages.po with Poedit, and update from sources, you should get Some TWIG text
fetched.
OS X Mountain lion, Latest Poedit
Невозможно выполнить программу: /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poedit9nrg0V/0extracted.pot" --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP --files "twig/test.twig"
run it with extractor from potest.loc folder and have the same result:
Невозможно выполнить программу: /Users/noon-ehos/work/sources/potest.loc/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poedit1hQOtS/0extracted.pot" --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP --files "twig/test.twig"
try to chmod 777 /var/folders and it's not take any help
but .php files work perfectly
now I try run it from terminal and change path to .pot file (now /var/folders/messages.pot) and messegas.pot:
# 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 19:30+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" #: /tmp/cache/511d1f2707d04/86/ee/8326cfaa885fa4c60dd1fcacdd2f.php:20 msgid "Some TWIG text" msgstr ""
but messages.po in project folder has no any strings from gettext()
What did you run in terminal?
I run
MacBook-Pro-Alexandr:potest.loc noon-ehos$ /Users/noon-ehos/work/sources/potest.loc/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/messages.pot" --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP --files "twig/test.twig"
OK, and it works like that, right? But does not work from Poedit?
yes, if I change the path to .pot file in command and run it from terminal, it work fine: no errors, created new correct .pot file, .po file no changes
Ofc, it will always output to where you tell via -o
option. What if you try to output to .po?
what i need to change in my parser command?
i run it for .po
MacBook-Pro-Alexandr:potest.loc noon-ehos$ /Users/noon-ehos/work/sources/potest.loc/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/messages.po" --from-code=utf-8 -k_ -kgettext -kgettext_noop -L PHP --files "twig/test.twig"
Work correct again but it from teminal. Can i set some multiproject-params for Poedit in parser command?
its PHP parser string:
xgettext --language=PHP --force-po -o %o %C %K %F
its your parser string:
...vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F
Why PHP parser change my .po files and your parser try to crate some strainge /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot or some like this?
Not sure, for me it works with Poedit 1.4.6 on Ubuntu. What is your version?
You can try to debug it by changing vendor/bin/twig-gettext-extractor or $ cp vendor/bin/twig-gettext-extractor bin/twig-gettext-extractor
and edit it. Don't forget to change parser command.
In this script, you can dump $_SERVER['argv']
and see what arguments Poedit sends to extractor.
Feel free to post dumps here.
ok, will try tomorow
Hi, today I have some progress :100: ,
I try to run Poedit app from terminal as root. I have many errors on loading app, but twig extractor was work fine!
so what problem? xgettext and php tools has difirent privileges? or i must se some privileges to twig-gettext-extractor?
You can try to add write privileges to /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot
.
no provileges to write folder or file not help becouse xgettext work with this folders correct from Poedit, problem in privilages difirents between xgettext and php or your script
Can you please set 777 and try again?
i try set 777 recursively for /var/folder/... and set 777 recursively for .../potest.loc/ where i have twig extractor. It not take effect
Poedit error message:
How I install Extractor in terminal: