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

Added regex parser #44

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

Conversation

phrobix
Copy link

@phrobix phrobix commented Dec 3, 2020

Since the current existing extractors didn't match our project, I've created an extractor to be used with regular expressions.

I think this can be a good additional extractor for this project since you can basically extract everything you want, even if your project isn't using HTML of JavaScript. You just have to create a good regex to extract strings from your files.

I hope you'll think this is a nice addition to your project.

@lukasgeiter
Copy link
Owner

Thank you for this PR! I like the idea of allowing users to extract using regex for cases not covered by proper parsers & extractors.

I'm not quite sure whether it makes sense to merge this PR though, because I'm currently working on a large rewrite for the next major release. The new version is a lot more modular and will have support for more languages and frameworks. In any case, I will make sure that this feature is included as well - and I can certainly use your code as a starting point.


Out of curiosity, what extractors would you need to match your project?

@phrobix
Copy link
Author

phrobix commented Dec 7, 2020

Hi, thanks for appreciating this pull request.

I don't know how much progress you've already made with the large rewrite. But I think if you still need some time to complete this rewrite and you'll add this regex extractor in the new upgrade, there is a benefit of merging this pull request. It gives people the possibility to already get started with this project and create a regex for their project. When the upgrade is ready they can upgrade easily because their regex already exists.

Out of curiosity, what extractors would you need to match your project?

We're using Handlebars for templating and have create our own helper for the to be translated strings. So we could have create a Handlebars extractor. But this was a more generic approach and I thought was going to add more value to this project since everyone could fallback to regex if their extractor was missing.

Maybe this extractor will be obsolete if the new version will be more modular so it will be easier to add custom extractors.

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