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 on windows7 #13

Open pouyasalimi opened 10 years ago

pouyasalimi commented 10 years ago

Hi I have problem setting Twig Gettext on windows7

I installed composer and did the jobs for downloading Twig-Gettext-Extractor. also set custom parser for TWIG files like you said.

When i run Pedit, I will got this error messages:

01/26/14 20:08:36: Execution of command './vendor/bin/twig-gettext-extractor --sort-output --force-po -o "C:\Users\Sony\AppData\Local\Temp\poe4ED0.tmp\11extracted.pot" --from-code=UTF-8 -k -k_e -kwp. -L PHP --files "../irsaplus/core/plugins/settings/templates/settings/tabs.twig" "../irsaplus/core/plugins/settings/templates/settings/wrapper.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/boolean.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/image.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_post_type.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_post_type_for_submission.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_user_role.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/textarea.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/textinput.twig" "../irsaplus/plugins/accounts/templates/accounts/login.twig" "../irsaplus/plugins/accounts/templates/accounts/register.twig" "../irsaplus/plugins/agencies/templates/agencies/widget.twig" "../irsaplus/plugins/agents/templates/agents/widget.twig" "../irsaplus/plugins/call-to-action/templates/call-to-action/widget.twig" "../irsaplus/plugins/partners/templates/partners/widget.twig"' failed (error 193: unknown error c1) 01/26/14 20:08:36: Cannot execute program: ./vendor/bin/twig-gettext-extractor --sort-output --force-po -o "C:\Users\Sony\AppData\Local\Temp\poe4ED0.tmp\11extracted.pot" --from-code=UTF-8 -k -k_e -kwp. -L PHP --files "../irsaplus/core/plugins/settings/templates/settings/tabs.twig" "../irsaplus/core/plugins/settings/templates/settings/wrapper.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/boolean.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/image.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_post_type.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_post_type_for_submission.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select_user_role.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/textarea.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/textinput.twig" "../irsaplus/plugins/accounts/templates/accounts/login.twig" "../irsaplus/plugins/accounts/templates/accounts/register.twig" "../irsaplus/plugins/agencies/templates/agencies/widget.twig" "../irsaplus/plugins/agents/templates/agents/widget.twig" "../irsaplus/plugins/call-to-action/templates/call-to-action/widget.twig" "../irsaplus/plugins/partners/templates/partners/widget.twig"

umpirsky commented 10 years ago

@ipouya Can you run it from command line? Maybe it is permissions problem, I am not into windows that much.

pouyasalimi commented 10 years ago

@umpirsky I got this error on command line:

Fatal error: Uncaught exception 'RuntimeException' with message 'Gettext command "xgettext --sort-output --force-po -o C:\Users\Sony\AppData\Local\Temp\poe3B6A. tmp\11extracted.pot --from-code=UTF-8 -k__ -k_e -kwp.__ -L D:\EasyPHP\binaries\p hp\php_runningversion\php.exe /tmp/cache/52e5f5eb8e890/54/8f/63991c591f63fc71bc4 fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5eb8e890/54/8f/639 91c591f63fc71bc4fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5e b8e890/54/8f/63991c591f63fc71bc4fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /t mp/cache/52e5f5eb8e890/54/8f/63991c591f63fc71bc4fd4c43bb30c57a99d9e15d31af8fa119 243a11620.php /tmp/cache/52e5f5eb8e890/54/8f/63991c591f63fc71bc4fd4c43bb30c57a99 d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5eb8e890/54/8f/63991c591f63fc71bc4 fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5eb8e890/54/8f/639 91c591f63fc71bc4fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5e b8e890/54/8f/63991c591f63fc71bc4fd4c43bb30c57a99d9e15d31af8fa119243a11620.php in D:\EasyPHP\data\localweb\wordpress\wp-content\themes\irmaskan\languages\vendor\ umpirsky\twig-gettext-extractor\Twig\Gettext\Extractor.php on line 79

umpirsky commented 10 years ago

@ipouya And when you run this xgettext command?

pouyasalimi commented 10 years ago

I run this command after poedit shows error in first comment i left above. I don't run xgettext, i don't know why it shows xgettext i run this command:

D:\EasyPHP\data\localweb\wordpress\wp-content\themes\irmaskan\languages\vendor\b in>twig-gettext-extractor --sort-output --force-po -o "C:\Users\Sony\AppData\Loc al\Temp\poe3B6A.tmp\11extracted.pot" --from-code=UTF-8 -k__ -k_e -kwp.__ -L D:\ EasyPHP\binaries\php\phprunningversion\php.exe --files "../irsaplus/core/plugi ns/settings/templates/settings/tabs.twig" "../irsaplus/core/plugins/settings/tem plates/settings/wrapper.twig" "../irsaplus/core/plugins/settings/templates/setti ngs/fields/boolean.twig" "../irsaplus/core/plugins/settings/templates/settings/f ields/image.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/s elect.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/select post_type.twig" "../irsaplus/core/plugins/settings/templates/settings/fields/sel ect_post_type_for_submission.twig" "../irsaplus/core/plugins/settings/templates/ settings/fields/select_user_role.twig" "../irsaplus/core/plugins/settings/templa tes/settings/fields/textarea.twig" "../irsaplus/core/plugins/settings/templates/ settings/fields/textinput.twig" "../irsaplus/plugins/accounts/templates/accounts /login.twig" "../irsaplus/plugins/accounts/templates/accounts/register.twig" ".. /irsaplus/plugins/agencies/templates/agencies/widget.twig" "../irsaplus/plugins/ agents/templates/agents/widget.twig" "../irsaplus/plugins/call-to-action/templat es/call-to-action/widget.twig" "../irsaplus/plugins/partners/templates/partners/ widget.twig"

umpirsky commented 10 years ago

Because it uses xgettext in the background, and that may be the source of your problem. Thats why I am suggesting to run

xgettext --sort-output --force-po -o C:\Users\Sony\AppData\Local\Temp\poe3B6A.
tmp\11extracted.pot --from-code=UTF-8 -k__ -k_e -kwp.__ -L D:\EasyPHP\binaries\p
hp\php_runningversion\php.exe /tmp/cache/52e5f5eb8e890/54/8f/63991c591f63fc71bc4
fd4c43bb30c57a99d9e15d31af8fa119243a11620.php /tmp/cache/52e5f5...

and see what is the problem.

umpirsky commented 10 years ago

To understand how it works, see https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/Twig/Gettext/Extractor.php#L70-L88

pouyasalimi commented 10 years ago

Thanks, I'll see what can i do ;)

kbtz commented 10 years ago

So... ?

umpirsky commented 10 years ago

Any updates on this @ipouya?

Vendredi3 commented 9 years ago

Hi all, I run into the same problem : First I installed via composer and set a new parser for twig.

when I tried to update my catalog in Poedit and received this error :

11/10/14 16:53:59: Execution of command 'X:/wamp/www/NH_Italie/reporting/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "C:\Users\Arnaud\AppData\Local\Temp\poeE6E9.tmp\259extracted.pot" --from-code=UTF-8  -k_ -ktrans -L PHP --files  "X:/wamp/www/NH_Italie/reporting/includes/twig_old/package.xml.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy (2) of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of admin_detail_poste.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of aff_global.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of stats_onglets.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/acces_interdit.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/arrivee.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_commercial_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing_region.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_modif.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_region_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_role.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/bons_livraison.tpl"' failed (error 193 : unknown error c1)
11/10/14 16:53:59: Cannot execute program: X:/wamp/www/NH_Italie/reporting/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "C:\Users\Arnaud\AppData\Local\Temp\poeE6E9.tmp\259extracted.pot" --from-code=UTF-8  -k_ -ktrans -L PHP --files  "X:/wamp/www/NH_Italie/reporting/includes/twig_old/package.xml.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy (2) of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of admin_detail_poste.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of aff_global.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of stats_onglets.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/acces_interdit.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/arrivee.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_commercial_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing_region.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_modif.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_region_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_role.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/bons_livraison.tpl"

So i tried to execute the following command in the console :

X:/wamp/www/NH_Italie/reporting/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "C:\Users\Arnaud\AppData\Local\Temp\poe4AF8.tmp\259extracted.pot" --from-code=UTF-8  -k_ -ktrans -L PHP --files  "X:/wamp/www/NH_Italie/reporting/includes/twig_old/package.xml.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy (2) of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of admin_detail_poste.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of aff_global.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of courbes_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/Copy of stats_onglets.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/acces_interdit.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/arrivee.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_commercial_ajout.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_listing_region.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_modif.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_region_detail.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/audit_role.tpl" "X:/wamp/www/NH_Italie/reporting/templates/fr/admin/bons_livraison.tpl

and get the following error :

xgettext: cannot create output file "C:\Users\Arnaud\AppData\Local\Temp\poe4AF8.
tmp\259extracted.pot": No such file or directory
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Gettext co
mmand "xgettext --sort-output --force-po -o C:\Users\Arnaud\AppData\Local\Temp\p
oe4AF8.tmp\259extracted.pot --from-code=UTF-8 -k_ -ktrans -L PHP /tmp/cache/5460
e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php
 /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f
928d734c616a.php /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d
3cafb2941b09672f928d734c616a.php /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e
732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460e27bb328a/fa/dd/
c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460
e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php
 /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f
928d734c616a.php /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d
3cafb2941b09672f928d734c616a.php /tmp/cache/5460e27bb328a/fa/dd/c55dd0ce7c54962e
73 in X:\wamp\www\Naturhouse_Italie\reporting\vendor\umpirsky\twig-gettext-extra
ctor\Twig\Gettext\Extractor.php on line 79

I tried the xgettext command :

xgettext --sort-output --force-po -o C:\Users\Arnaud\AppData\Local\Temp\poe4AF8.tmp\259extracted.pot --from-code=UTF-8 -k_ -ktrans -L PHP /tmp/cache/5460e4f22d458/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460e4f22d458/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460e4f22d458/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460e4f22d458/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php /tmp/cache/5460e4f22d458/fa/dd/c55dd0ce7c54962e732020f4c21f9d2d3cafb2941b09672f928d734c616a.php

I had the following error :

xgettext: cannot create output file "C:\Users\Arnaud\AppData\Local\Temp\poe4AF8.tmp\259extracted.pot": No such file or directory

For testing purpose I replaced %o in the Parser command by X:\wamp\www\NH_Italie\reporting\locale\it_IT\LC_MESSAGES\extracted.pot that point to an existing file, An re run the update in Poedit => same error.

BUT when I tried to run X:/wamp/www/NH_Italie/reporting/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "X:\wamp\www\NH_Italie\reporting\locale\it_IT\LC_MESSAGES\extracted.pot" --from-code=UTF-8 [...] on the console, it has updated the extracted.pot file with the following content :

# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-10 17:32+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

I'm a little bit confused, and any help will be much appreciated

umpirsky commented 9 years ago

@Vendredi3 Thanks for your feedback.

I never tested it on Windows, really nonsense erorr:

xgettext: cannot create output file "C:\Users\Arnaud\AppData\Local\Temp\poe4AF8.tmp\259extracted.pot": No such file or directory

Can it be a permissions issue?

Vendredi3 commented 9 years ago

Hi @umpirsky , thanks for answering.

I don't think it can be a permission issue (as to be sure I gave full control to Users on Temp directory)

umpirsky commented 9 years ago

@Vendredi3 Hehum, I really have no idea, sorry. Windows support is never planned for this project, but if someone can submit PR I will gladly review and merge.

Vendredi3 commented 9 years ago

Ok, thanks anyway. I finally scanned the twig cache (which contains php files)