Comments (5)
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:
id: 94, raw_key: activerecord.errors.template.header, value: 1 error prohibited this {{model}} from being saved
id: 95, raw_key: activerecord.errors.template.header, value: {{count}} errors prohibited this {{model}} from being saved
It seems like it grabbed those correctly. Shoot me an example, maybe console output if you can, and I'll be happy to help!
from i18n_backend_database.
If you add a call to the translate method that looks something like this:
I18n.t('activerecord.errors.messages.record_invalid', :errors => errors)
The rake task fails.
This could be a bit of an edge case, I'm not really sure.
from i18n_backend_database.
I just ran this command in console, and it worked fine:
I18n.t('activerecord.errors.messages.record_invalid', :errors => "test test test")
=> "Validation failed: test test test"
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?
from i18n_backend_database.
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?
from i18n_backend_database.
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!
from i18n_backend_database.
Related Issues (12)
- Please add a license file HOT 2
- License issue HOT 1
- Error at "rails g i18n_backend_database" (Rails 3.1) HOT 1
- Rails 3.x support HOT 3
- use text instead of strings for raw_key, value HOT 2
- Provide an easy way to restrict access to provided controllers HOT 3
- create_seed_translations should look for I18n.translate as well as I18n.t
- seed_application_translations not respecting options
- tlt shouldn't allow blank entries
- "Interpolation argument * missing in *" error in rake task
- rails 2.3.8 bug HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from i18n_backend_database.