Comments (5)
@kuroda I agree with @jrochkind, dynamic_form gem does not work for me.
Instead, this worked for me:
<%= t('errors.template.header', :model => Model.model_name.human, :count => model.errors.count) %>
from rails-i18n.
Thanks for looking at it!
Alexey.
from rails-i18n.
Hi, Alexey
Look at the app/views/users/_form.html.erb
generated by scaffold. The error message is hard coded. So, changing the locale file has no effect.
Actually, the Rails 3.0 does not utilize the activerecord.errors.template.header
translation. In the Rails 2.x, this translation is used in the error_messages
method of the form builder, but this method is deprecated and extracted as a plugin.
If you are curious, do the following:
rails plugin install git://github.com/joelmoss/dynamic_form.git
- Edit
app/views/_form.html.erb
as follows:
<%= form_for(@user) do |f| %>
<%= f.error_messages %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
from rails-i18n.
Thank you, i have overlooked this.
from rails-i18n.
finding this way later, scaffold still generates hard-coded error text, but f.error_messages
doesn't seem to exist anymore as a method on the form builder.
The i18n data is still in the repo.... not sure how to use it!
from rails-i18n.
Related Issues (20)
- Welsh: missing translations for CY locale HOT 14
- feature: Translations for Rails::Generators HOT 7
- Problem Counting Locales HOT 6
- thor list and count_all ignore iso-639-2 locales HOT 1
- date.formats are reported as having broken data HOT 2
- en locale errors.template.header wrongly reported as having broken data HOT 3
- Missing key: errors.messages.in HOT 2
- Missing key: number.format.round_mode
- thor locales:test en does not report missing keys
- Support for `many` pluralization category (CLDR v41)
- Missing base ZH locale? HOT 7
- Can't find activerecord errors for de.yml
- Cut a release? HOT 1
- Please release a new version HOT 2
- Abbreviated months in short time format for German
- Passing string in French locale throws the following error "comparison of String with 0 failed" HOT 7
- Translation of strings ending in `.` HOT 2
- Would you be willing to cut a new release? HOT 1
- nb locale uses count in errors.messages.restrict_dependent_destroy.has_one
- `<%= t(:help) %>` outputs entire content of a .yml translation file as a Hash HOT 2
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 rails-i18n.