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

Not parse twig files #5

Open oleksandr-diudiun opened 11 years ago

oleksandr-diudiun commented 11 years ago

Poedit error message:

Невозможно выполнить программу: /Users/noon-ehos/work/sources/Twig-Gettext-Extractor/vendor/bin/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditTFylWe/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"

How I install Extractor in terminal:  2013-02-07 16 21 21  2013-02-07 16 22 11

sh-3.2# php composer.phar install --dev
Loading composer repositories with package information
Installing dependencies
  - Installing symfony/translation (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing twig/twig (dev-master c6445fb)
    Cloning c6445fb5cd6823f7bd65108a717064957b6eafd5

  - Installing symfony/filesystem (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing symfony/routing (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing symfony/twig-bridge (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing twig/extensions (dev-master 5c2d515)
    Cloning 5c2d515d4624bdd588226d688173cf0399a4d8cf

  - Installing umpirsky/twig-gettext-extractor (1.1.2)
    Loading from cache

  - Installing symfony/options-resolver (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing symfony/locale (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing symfony/event-dispatcher (2.1.x-dev v2.1.7)
    Cloning v2.1.7

  - Installing symfony/form (2.1.x-dev v2.1.7)
    Cloning v2.1.7

Loading composer repositories with package information
Installing dev dependencies
Nothing to install or update
symfony/translation suggests installing symfony/config (2.1.*)
symfony/translation suggests installing symfony/yaml (2.1.*)
symfony/routing suggests installing doctrine/common (>=2.2,<2.4-dev)
symfony/routing suggests installing symfony/config (2.1.*)
symfony/routing suggests installing symfony/yaml (2.1.*)
symfony/twig-bridge suggests installing symfony/templating (2.1.*)
symfony/twig-bridge suggests installing symfony/yaml (2.1.*)
symfony/twig-bridge suggests installing symfony/security (2.1.*)
symfony/locale suggests installing ext-intl (>=5.3.3)
symfony/event-dispatcher suggests installing symfony/dependency-injection (2.1.*)
symfony/event-dispatcher suggests installing symfony/http-kernel (2.1.*)
symfony/form suggests installing symfony/validator (2.1.*)
symfony/form suggests installing symfony/http-foundation (2.1.*)
Writing lock file
Generating autoload files
sh-3.2# ls
.DS_Store   composer.json   composer.lock   composer.phar   vendor
umpirsky commented 11 years ago

Hi, thanks for using Twig Gettext Extractor!

Can you please run command from "Poedit error message", and post the output.

oleksandr-diudiun commented 11 years ago

 2013-02-07 18 21 42

umpirsky commented 11 years ago

Please run that gettext command and paste text output instead of image screenshots, use markdown.

oleksandr-diudiun commented 11 years ago
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
umpirsky commented 11 years ago

No, not that command, run command that is reported to fail in error message xgettext --sort-output --force-po ....

oleksandr-diudiun commented 11 years ago
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
umpirsky commented 11 years ago

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.

oleksandr-diudiun commented 11 years ago

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

umpirsky commented 11 years ago

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.

oleksandr-diudiun commented 11 years ago

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
umpirsky commented 11 years ago

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

?

oleksandr-diudiun commented 11 years ago

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"
oleksandr-diudiun commented 11 years ago

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
umpirsky commented 11 years ago

Change /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditatIZ5x/0extracted.pot to pont to your .pot file and run again.

oleksandr-diudiun commented 11 years ago

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
umpirsky commented 11 years ago

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.

oleksandr-diudiun commented 11 years ago
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

oleksandr-diudiun commented 11 years ago

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# 
oleksandr-diudiun commented 11 years ago

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"
oleksandr-diudiun commented 11 years ago

but old file was have much more data

oleksandr-diudiun commented 11 years ago

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 :(

umpirsky commented 11 years ago

I can find some time to debug this during the weekend. Can you create a test repo on github so we can debug?

oleksandr-diudiun commented 11 years ago

Ok, i will create repo and post url here in few hours

umpirsky commented 11 years ago

Perfect, thanks!

oleksandr-diudiun commented 11 years ago

https://github.com/noon-ehos/potest.loc I add you as collaborator.

umpirsky commented 11 years ago

:thumbsup:

umpirsky commented 11 years ago

You missed composer.json, and extractor dependency in it :)

oleksandr-diudiun commented 11 years ago

It's correct ? https://github.com/noon-ehos/potest.loc/blob/master/composer.json

umpirsky commented 11 years ago

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.

oleksandr-diudiun commented 11 years ago

OS X Mountain lion, Latest Poedit

oleksandr-diudiun commented 11 years ago

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"
oleksandr-diudiun commented 11 years ago

try to chmod 777 /var/folders and it's not take any help

oleksandr-diudiun commented 11 years ago

but .php files work perfectly

oleksandr-diudiun commented 11 years ago

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 ""
oleksandr-diudiun commented 11 years ago

but messages.po in project folder has no any strings from gettext()

umpirsky commented 11 years ago

What did you run in terminal?

oleksandr-diudiun commented 11 years ago

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"
umpirsky commented 11 years ago

OK, and it works like that, right? But does not work from Poedit?

oleksandr-diudiun commented 11 years ago

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

umpirsky commented 11 years ago

Ofc, it will always output to where you tell via -o option. What if you try to output to .po?

oleksandr-diudiun commented 11 years ago

what i need to change in my parser command?

oleksandr-diudiun commented 11 years ago

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?

oleksandr-diudiun commented 11 years ago

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?

umpirsky commented 11 years ago

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.

oleksandr-diudiun commented 11 years ago

ok, will try tomorow

oleksandr-diudiun commented 11 years ago

Hi, today I have some progress :100: ,

  1. I see that path /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot is standart temporary for Poedit and after that result, he write it to my .po file.
  2. TWIG-extractor show error for write tmp file, but php extractor (xgettext) work perfect.

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?

umpirsky commented 11 years ago

You can try to add write privileges to /var/folders/vg/0_6ypnj11cs5hd0yxwd6hbyc0000gn/T/poeditaOSeOc/17extracted.pot.

oleksandr-diudiun commented 11 years ago

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

umpirsky commented 11 years ago

Can you please set 777 and try again?

oleksandr-diudiun commented 11 years ago

i try set 777 recursively for /var/folder/... and set 777 recursively for .../potest.loc/ where i have twig extractor. It not take effect