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

Hi, I can't understand how i can install your tool without composer #3

Closed oleksandr-diudiun closed 11 years ago

oleksandr-diudiun commented 11 years ago

Hi, I can't understand how i can install your tool without composer. I use twig with my PHP framework (not syphony). And I never use composer. But i want to use your tool with POEDIT on OS X. What i must do to install and configure Extractor?

oleksandr-diudiun commented 11 years ago

Now after trying to configure extractor. I have errors like:

/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/twig-gettext-extractor --sort-output --force-po -o "/var/folders/vg/06ypnj11cs5hd0yxwd6hbyc0000gn/T/poedit4HuxM3/17extracted.pot" --from-code=UTF-8 -k -kgettext -kgettext_noop -L PHP --files "/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/Twig/Gettext/Test/Fixtures/twig/empty.twig" "/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/Twig/Gettext/Test/Fixtures/twig/plural.twig" "/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/Twig/Gettext/Test/Fixtures/twig/singular.twig" "/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"

oleksandr-diudiun commented 11 years ago

If i try to run it in terminal, i got: Warning: require_once(/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/vendor/autoload.php): failed to open stream: No such file or directory in /Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/twig-gettext-extractor on line 22

Fatal error: require_once(): Failed opening required '/Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/vendor/autoload.php' (include_path='.:') in /Users/noon-ehos/work/sources/vnmu.loc/Twig-Gettext-Extractor/twig-gettext-extractor on line 22

umpirsky commented 11 years ago

Hi, thanks for using Twig Gettext Extractor!

I recommend to install it with composer. As you can see here it looks for autoload.php, you can create it, or change/implement autoloading inside twig-gettext-extractor script or create similar one that works for your case. If you don't use composer, you should setup autoloader on your own, just like in other parts of your project.

I hope this helps.

oleksandr-diudiun commented 11 years ago

You know russian?

umpirsky commented 11 years ago

Hard to tell, I know, but it's pretty poor :)

oleksandr-diudiun commented 11 years ago

ok :+1: . Now I not understand what role of autoloader.php in this tool. It's script must start some simphony core, or TWIG core, or composer core? Where creating this file and from who? (when you install extractor from composer)

umpirsky commented 11 years ago

The role of /autoload.php is to setup autoloading for project classes, read more on http://php.net/manual/en/language.oop5.autoload.php

If you look at https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/twig-gettext-extractor#L19 you will see that it is created in __DIR__.'/../../autoload.php'.

I suggest you to try https://github.com/composer/composer, it will be easier since you are not familiar with autoloading in php.

oleksandr-diudiun commented 11 years ago

Ok I know about oop5 autoload, but ... "for project classes" ... it's for my classes? for extractor classes? or for composer classes?

and one more question. For understand ... created in DIR.'/../../autoload.php'... i must understand where to put extractor? in root of myProject folder or one level up? (cd ..)

umpirsky commented 11 years ago

Autoload for extractor classes and all dependent packages.

Again https://github.com/umpirsky/Twig-Gettext-Extractor/blob/master/twig-gettext-extractor#L19, whenever you put extractor, autoload should be in __DIR__.'/../../autoload.php' or __DIR__.'/vendor/autoload.php'.

Or copy twig-gettext-extractor script wherever fits for you.

oleksandr-diudiun commented 11 years ago

sorry, maybe next question will so idiot, but if DIR is't Extractor dir, than why i not see vendor folder in that? or it's created by composer in your case?

oleksandr-diudiun commented 11 years ago

ok, i was read detaile information about composer on russian http://habrahabr.ru/post/145946/ and uderstand about autoload.php, that it's generated by composer for inside dependings of Extractor. So i will read more and try to use composer. Thanks for help!