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

The Twig extraction should use the Symfony extractor #33

Open
stof opened this issue Feb 20, 2017 · 3 comments
Open

The Twig extraction should use the Symfony extractor #33

stof opened this issue Feb 20, 2017 · 3 comments

Comments

@stof
Copy link

stof commented Feb 20, 2017

The extractor you wrote misses lots of features of the Symfony Twig bridge:

  • it does not support the trans_choice tag
  • it does not support the trans_default_domain tag

Symfony already maintains a Twig extractor since years, which covers all features listed above, and is kept uptodate for changes in the features.
You should use it inside your extractor instead of duplicating the work.

@Nyholm
Copy link
Member

Nyholm commented Feb 27, 2017

I did not know Symfony had an extractor. Hm, wonder why I missed that.

We should definitely work together then. Thank you!

@Nyholm
Copy link
Member

Nyholm commented Mar 10, 2017

I've looked into this. Symfonys extractors are located in Symfony\Bundle\FrameworkBundle\Translation and Symfony\Bridge\Twig\Translation.

I would love to use them but I will not pull down the FrameworkBundle and TwigBridge just to use two classes. Is there a way we can work around this?

@stof
Copy link
Author

stof commented Mar 20, 2017

FrameworkBundle is not necessary for the Twig extractors AFAIK.

The TwigBridge is necessary because it is the one implementing the translation tags. So if the bridge is not installed, there is nothing to extract anyway (and if there is something, you cannot parse the template). So there is no new dependency when using it.
You could make it an optional requirement in your composer.json, and register the extractor only when it is available. If the bridge is not there, you know there is nothing to extract anyway.

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

No branches or pull requests

2 participants