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

Error "unmatched close parenthesis" (compile_key_pattern) when running i18n-tasks health #180

Closed
lucascaton opened this issue Dec 4, 2015 · 12 comments
Labels
Milestone

Comments

@lucascaton
Copy link

When I run $ i18n-tasks health, I got this result:

`Forest (en, pt-BR) has 274 keys across 2 locales. On average, values are 15 characters long, keys have 3.1 segments, a locale has 137 keys.
✓ Well done! No translations are missing.

~/.rvm/gems/ruby-2.2.3/gems/i18n-tasks-0.9.2/lib/i18n/tasks/key_pattern_matching.rb:22:in `compile_key_pattern': unmatched close parenthesis: /\A((?<=^|\.)[^.]+?(?=\.|$)|'\.'))\.(?<=^|\.)[^.]+?(?=\.|$)\.title,landing_pages\.index\.features_(?<=^|\.)[^.]+?(?=\.|$),landing_pages\.index\.features_(?<=^|\.)[^.]+?(?=\.|$)_description,landing_pages\.index\.platform_(?<=^|\.)[^.]+?(?=\.|$),landing_pages\.index\.platform_(?<=^|\.)[^.]+?(?=\.|$)_description,landing_pages\.index\.footer-(?<=^|\.)[^.]+?(?=\.|$)_version}\z/ (RegexpError)
  • Mac OS X 10.11.1
  • Ruby 2.2.3
  • Rails 4.2.5
  • i18n-tasks (gem) 0.9.2
@glebm
Copy link
Owner

glebm commented Dec 6, 2015

Can you post your config/i18n-tasks.yml?

@lucascaton
Copy link
Author

@glebm Sure!

config/i18n-tasks.yml

base_locale: en

data:
  read:
    - config/locales/**/%{locale}.yml
    - config/locales/**/*.%{locale}.yml

search:
  exclude:
    - app/assets/images
    - app/assets/fonts

My locale files:

config/locales
├── activerecord.en.yml
├── activerecord.pt-BR.yml
├── enumerations.en.yml
├── enumerations.pt-BR.yml
└── views
    ├── calendars.en.yml
    ├── calendars.pt-BR.yml
    ├── categories.en.yml
    ├── categories.pt-BR.yml
    ├── dashboard.en.yml
    ├── dashboard.pt-BR.yml
    ├── devise.en.yml
    ├── devise.pt-BR.yml
    ├── en.yml
    ├── landing_pages.en.yml
    ├── landing_pages.pt-BR.yml
    ├── pt-BR.yml
    ├── settings.en.yml
    ├── settings.pt-BR.yml
    ├── transactions.en.yml
    └── transactions.pt-BR.yml

@lucascaton
Copy link
Author

@glebm hi there. Any clue how to fix it? Thanks 😄

@glebm
Copy link
Owner

glebm commented Dec 21, 2015

Looks like there is a dynamic key usage in the code with a key that looks something like below that i18n-tasks has trouble with:

t('landing_pages.index.footer-#{stuff}_version')

Can you post the exact code of that usage here? Thanks

@lucascaton
Copy link
Author

Yep, this the part of my haml where I'm using it:

- Locale.list.each do |locale|
  = link_to t(".footer-#{locale}_version", locale: locale), locale: locale

@glebm
Copy link
Owner

glebm commented Dec 21, 2015

Looks like that's not the key that's causing the issue. Could you perhaps inspect the output of:

i18n-tasks find --no-strict

You can use the command below to see just the keys:

i18n-tasks find --no-strict -fkeys

and see if there is anything fishy in there?

@lucascaton
Copy link
Author

Sure!

i18n-tasks find --no-strict: https://gist.github.com/lucascaton/92153a95290e565e2b31
i18n-tasks find --no-strict -fkeys: https://gist.github.com/lucascaton/ccd664189febc3005bd6

glebm added a commit that referenced this issue Dec 22, 2015
@glebm
Copy link
Owner

glebm commented Dec 22, 2015

Thanks! The commit above should fix it.

@glebm glebm added the bug label Dec 22, 2015
@glebm glebm added this to the v0.9.3 milestone Dec 22, 2015
@lucascaton
Copy link
Author

It worked, thanks a lot! 😄

@lucascaton
Copy link
Author

@glebm could you please bump a new version? Thanks again!

@glebm
Copy link
Owner

glebm commented Feb 4, 2016

@lucascaton Released in v0.9.3.

@lucascaton
Copy link
Author

@glebm thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants