-
Notifications
You must be signed in to change notification settings - Fork 32
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
rake i18n:populate:all causes interpolation argument errors missing in "Validation failed: {{errors}}" #4
Comments
Hello Jay! Could you show me a way to reproduce? I just created a blank 2.3.5 application, ran the tasks, created a model, and wasn't able to find any issues. id: 93, raw_key: activerecord.errors.template.body, value: There were problems with the following fields: It seems like it grabbed those correctly. Shoot me an example, maybe console output if you can, and I'll be happy to help! |
If you add a call to the translate method that looks something like this: This could be a bit of an edge case, I'm not really sure. |
I just ran this command in console, and it worked fine:
Then, I ran the "rake i18n:populate:all", and it ran without any errors. Are there any more details you can provide? Can you show me what you database records look like? |
Doing that in the console and then running the rake task will do nothing since the task parses the application files to look for those calls. Drop that call into your app anywhere (view, controller, model) then running the rake task will fail. Personally I don't really like the rake tasks and think it would be better to have a hook in the actual I18n.t call, if no translation is found it puts it into the database instead of parsing the files. Does that make sense? |
Perfect, I was able to replicate. The regular expression within the actual rake task is not pulling in the interpolation arguments it seems, which is a problem. In regard to the rake tasks, you don't need to run them, and by default, if a translation does not exist for a given key, it is created. The rake tasks act as a way to bootstrap existing applications. For example, the application this was created for has many views that can be in many states, so manually triggering each translation was not an option. Using the tasks, we were able to auto-create about 10k+ translations that the translators could start working on immediately. Thanks again for the heads up on this! |
We're running Rails 2.3.5, not sure if something changed in there. The problem has to do with some of the stuff in this commit http://github.com/dylanz/i18n_backend_database/commit/e1faa3f384daf26b2809aadfdb4f86569615497f
What I was seeing is the object that was being scanned for interpolation arguments looking something like this:
"'activerecord.errors.messages.record_invalid', :errors=>errors"
and not being able to parse out the fact that it needs an errors option. My regex_fu is limited so I haven't been able to come up with something better.
The text was updated successfully, but these errors were encountered: