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
Fix the translation commands when a template contains a syntax error #34711
Conversation
This is not the right fix IMO: this catches the errors at the level of a Twig top-level folder. So it will ignore any other template in the same folder if one of them has an issue (so ignoring twig-bridge entirely for instance). We should rather catch things for each template separately, to keep processing others. |
Also, doing this in the extractor would also mean that it applies to other tools using the extractor. |
I would not do it at the extractor level as it would mean that we would not be able to emit a notice (which might be fine after all). Ignoring a directory is not a problem IMO as there is a syntax error that should be fixed if this is a directory in the user project, and for built-in templates, we don't really care. |
well, bundles might have some templates used for specific case like that. And this extractor would then skip the whole bundle templates. The translation extractor is not responsible for linting templates (we have a command for that), and ignoring valid templates makes it less useful. |
f63e843
to
3ae5d17
Compare
@stof code updated :) |
3ae5d17
to
f588c6e
Compare
But tests should be updated :) |
f588c6e
to
c239ed3
Compare
c239ed3
to
7f803bc
Compare
…ntax error (fabpot) This PR was merged into the 3.4 branch. Discussion ---------- Fix the translation commands when a template contains a syntax error | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #34586 | License | MIT | Doc PR | n/a When using `debug:translation` or `translation:update`, we should catch exceptions to avoid breaking the command. It was not really an issue before Symfony 4.4/5 as we didn't have templates in the core that use features from optional dependencies. Commits ------- 7f803bc Fix the translation commands when a template contains a syntax error
When using
debug:translation
ortranslation:update
, we should catch exceptions to avoid breaking the command. It was not really an issue before Symfony 4.4/5 as we didn't have templates in the core that use features from optional dependencies.