Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display which template files are processed and what the final command is #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

drzraf
Copy link

@drzraf drzraf commented Dec 9, 2016

Useful debugging information when parsing stranges twig templates (like those containing unrecognized extensions)

@drzraf
Copy link
Author

drzraf commented Dec 9, 2016

Happens that any STDERR output (assumed from xgettext) is interpreted as a failure by poedit.
Dunno if poedit accept distinct "warning/notice" levels from xgettext.
Prefixing lines by "xgettext: notice: " did not do the trick.
Dunno

@umpirsky
Copy link
Owner

Thanks @drzraf.

How are this debug printed? Are they visible in Poedit?

@drzraf
Copy link
Author

drzraf commented Dec 11, 2016

Yes; AFAICT any output on stderr from the internal xgettext process is interpreted as an error, but poedit sources would need to be checked to know if it understand of some pattern for warning/notices/...

@drzraf
Copy link
Author

drzraf commented Jul 20, 2018

ping?
Is the project really dead?

@umpirsky
Copy link
Owner

It's not dead, people use it. So it lives.

@@ -25,6 +25,7 @@ if (file_exists($a = __DIR__ . '/../../autoload.php')) {
$twig = new Twig_Environment(new Twig\Gettext\Loader\Filesystem(DIRECTORY_SEPARATOR), [
'cache' => implode(DIRECTORY_SEPARATOR, [sys_get_temp_dir(), 'cache', uniqid()]),
'auto_reload' => true,
'debug' => getenv("DEBUG")
Copy link
Owner

Choose a reason for hiding this comment

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

Let's use 'debug' => getenv('TWIG_GETTEXT_EXTRACTOR_DEBUG') here.

@umpirsky
Copy link
Owner

Sorry for the delay, I'd like to merge this after env var name change. I'd like to avoid collision with other env vars.

Thanks!

@drzraf
Copy link
Author

drzraf commented Jul 20, 2018

Addressed (but see #60...)

@umpirsky
Copy link
Owner

Yes, this is obsolete in favor of #60.

drzraf pushed a commit to drzraf/Twig-Gettext-Extractor that referenced this pull request Jul 20, 2018
drzraf pushed a commit to drzraf/Twig-Gettext-Extractor that referenced this pull request Jul 20, 2018
* 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)
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