-
Notifications
You must be signed in to change notification settings - Fork 264
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" doesn't work #75
Comments
Perhaps master works for you?
$ bundle update i18n-tasks
$ bundle exec i18n-tasks unused |
No, I now get the following error:
|
I wonder what keys are coming from the scanner?
|
I tried posting the result of scanner.keys, but it's too long for github.
|
Pushed what may be a fix to master 5775bc3 |
Same problem :(
|
here is my config file, for reference:
|
The config looks OK. It fails when creating a tree from scanner.keys: Tree::Siblings.from_key_attr scanner.keys I don't know which key is causing the problem, but I should be able to reproduce this if I have Please switch to branch
|
Nevermind, I now know what's wrong, will push a fix shortly (better error message on namespace/leaf conflict) |
As part of implementation, i18n-tasks merges locales trees together. This error can happen when merging trees like these two: Tree A: common: Common Tree B: common:
hello: Hello
I am not yet sure what i18n-tasks should do in this case, but I've added an error message that tells which key is causing this on branch |
^ issue a warning and not 💥 |
0.6.0 is now out with this issue fixed, please reopen if still broken |
Hi, Unfortunately it doesn't work quite well yet.
And here's my config file:
Regarding the "i18n-tasks: [WARN] 'protenders' was a leaf, now has children (value <- scope conflict)" warning message, I have searched through my locale files and although i DID initially ahve this conflict, I removed it but still have the message that appears. Also, for sanity, is it possible to display the total number of keys that are being read as I have a feeling that he's not picking up all my locale files. |
If the message is showing, the problem is still present, run: git grep 'protenders:' -- config/locales/**/*.yml You can check the keys like this from > tree('en')
> tree('en').leaves.count
> guide # learn more |
This is what i get after running the grep command:
Notice that the 3 different "protenders" are all at different levels (companies.transactions.protenders, protenders, layout.protenders) or under other keys, so they shouldn't be conflicting... |
According to the message there is a conflict on the top level (it is not necessarily |
With the latest version (0.6.1) freshly installed, I don't get that warning anymore, but it still shows me that there are no unused keys even tho I've added a totally random one at the top of the file.
and I've added the following key at the top of my "en.yml" file:
|
Dynamic key matching was too aggressive, changed on master, does it work? Use bundle exec when running |
hehe now it does work, but i get a feeling it's too soft. I get 1334 unused keys, which I doubt is correct :) |
🎱 Might need an option to ignore dynamic usages (not consider |
If the unused keys are Rails magic keys (model attribute names etc), there are two options: A) Mark the usages with an explicit comment (had not been documented before): # i18n-tasks-use t('activerecord.models.user')
User.model_name.human B) Alternatively, add the keys to config |
Added a strict mode to i18n-tasks unused --strict |
Given this config file:
When i run "bundle exec i18n-tasks unused" it tells me that I have 0 unused strings, altho I know for a fact that this is not right as I added a couple of random strings in there.
The text was updated successfully, but these errors were encountered: