Skip to content

symfony-console arguments handling + WordPress Timber bridge - #60

Open
drzraf wants to merge 4 commits into
umpirsky:masterfrom
drzraf:args
Open

symfony-console arguments handling + WordPress Timber bridge#60
drzraf wants to merge 4 commits into
umpirsky:masterfrom
drzraf:args

Conversation

@drzraf

@drzraf drzraf commented Jul 20, 2018

Copy link
Copy Markdown
  • This commit uses symfony-console for manage arguments specific to Twig-Gettext-Extractor which used to be broken.
  • The $input is also passed to the extractor for possible futur use (eg: handling --debug)
  • Better Twig loaded. Twig Environment use a ChainLoader which is initialized according to file/paths passed to the command line.
  • It's possible to add a template directory the Twig-way and compile for one (or multiple templates).
  • The list of Twig templates to compile can now be passed through stdin, using --files stdin
  • Twig_SimpleFilter is fixed. true is not an accepted value anymore. Empty value callback avoid the cryptic Twig error: Function 1() does not exist
  • A --require flag is added to add custom PHP code before compilation.
  • Using the above, a brigde with WordPress+Timber is added. It loads Timber Twig extensions and add a couple of WordPress specific parameters to xgettext.

@umpirsky umpirsky left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, look promising. 👍

Please update https://github.com/umpirsky/Twig-Gettext-Extractor/#setup since old setup does not work any more.

Comment thread Twig/Gettext/Extractor.php Outdated
{
$this->environment = $environment;
$this->reset();
$this->input = $input;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->input is not defined in Extractor.

Comment thread twig-gettext-extractor Outdated
* This file is part of the Twig Gettext utility.
*
* (c) Саша Стаменковић <umpirsky@gmail.com>
* (c) 2018 Raphaël Droz <raphael.droz+floss@gmail.com>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this as author, not a copyright holder.

Comment thread composer.json Outdated
"symfony/form": "~3.0|~4.0",
"symfony/asset": "~2.8|~3.0|~4.0"
"symfony/asset": "~2.8|~3.0|~4.0",
"symfony/console": "^4.1"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also support 4.0 with ~4.0. No reason not to.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore, I'll fix this in #61

Comment thread twig-gettext-extractor Outdated
}
}
$file_loader = new Twig_Loader_Array($files);
$loaders->addLoader($file_loader);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$loaders->addLoader(new Twig_Loader_Array($files));

Comment thread Twig/Gettext/Extractor.php Outdated
protected $parameters;

/**
* @var `Symfony\Component\Console\Input\ArgvInput

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ```. Use InputInterface instead.

Comment thread Twig/Gettext/Extractor.php Outdated
{
$this->environment = $environment;
$this->reset();
$this->input = $input;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hang on, $this->input is never used, why do we have it here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially intended to use some input arguments (like debug) inside the Extractor.
Finally it was not the case, but that may useful later.
I've no problem with dropping it btw

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's drop it.

* This commit uses symfony-console for manage arguments specific to Twig-Gettext-Extractor which used to be broken.
* The $input is also passed to the extractor for possible futur use (eg: handling --debug)
* Better Twig loaded. Twig Environment use a ChainLoader which is initialized according to file/paths passed to the command line.
* It's possible to add a template directory the Twig-way and compile for one (or multiple templates).
* The list of Twig templates to compile can now be passed through stdin, using --files stdin
* Twig_SimpleFilter is fixed. true is not an accepted value anymore. Empty value callback avoid the cryptic Twig error: `Function 1() does not exist`
* A --require flag is added to add custom PHP code before compilation.
* Using the above, a brigde with WordPress+Timber is added. It loads Timber Twig extensions and add a couple of WordPress specific parameters to xgettext.
* integrate umpirsky#53 (debugging)
@umpirsky

Copy link
Copy Markdown
Owner

Please update with latest master, travis fails now.

@umpirsky

Copy link
Copy Markdown
Owner

@drzraf What is the status of the PR? Looks like we only need to update README to be able to setup Poedit.

@drzraf

drzraf commented Jul 22, 2018

Copy link
Copy Markdown
Author

I updated the command in README.md, but not the text that appears inside the screenshot (new screenshot is needed). Could you?

@umpirsky

umpirsky commented Jul 23, 2018

Copy link
Copy Markdown
Owner

Sure, let's fix tests first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants