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

Unused task producing regexperror: premature end of char-class #354

Closed
acetinick opened this issue Jun 8, 2020 · 2 comments · Fixed by #397
Closed

Unused task producing regexperror: premature end of char-class #354

acetinick opened this issue Jun 8, 2020 · 2 comments · Fixed by #397

Comments

@acetinick
Copy link

acetinick commented Jun 8, 2020

Hi,

I am looking to use the unused task across my very large Rails to find unused locales. I have a lot of dynamic locales in the code, as assume this might be causing errors.

Any way i can work out what particularly is causing the issue with the task?

I have run this task using with and without the "--no-strict" parameter.

Below is the detailed output:
image

Ruby 2.6.6
Rails 6.0.3.1
i18n-tasks 0.9.31

@tomaadland
Copy link

I have the same problem with dynamic locales. Setting search.strict to false is not working.

@acetinick did you find a solution for this ?

@tomaadland
Copy link

After a few hours of debugging I finally found the problem in my source.

One of the dynamic locales is an array lookup: t("loopup.something.in.#{somearray["element"]}") when this is compiled to key pattern it ends up with this result (lookup\.something\.in\.somearray[|) which makes the conversion to Regexp fail. The open bracket [ is the culprit here.

Solution for my problem was to remove the array lookup into a helper method.

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 a pull request may close this issue.

2 participants