I used the instructions given at http://guides.rubyonrails.org/i18n.html
to translate the fields of my model, but these labels are not translated. What am I doing wrong.
I have a model Userwith a field name, and I would like it to be translated into Brazilian Portugal (pt_br), so I got my pt_br.yml:
pt_br:
errors: "Erro!"
activerecord:
models:
user: "Usuário"
attributes:
name: "Nome"
address: "Endereço"
errors:
template:
body: "Por favor, corrija os campos assinalados"
header: "Dados inválidos"
messages:
blank: "é obrigatório"
taken: "já existe"
too_short: "incompleto"
when I got to the page with the form:
<% form_for(@usuario) do |f| %>
<%= f.error_messages %>
<%= f.label :name %>
<%= f.text_field :name %>
<% end %>
I have a field labeled as “name” and not as “Nome” as I would like. I also have
config.i18n.default_locale = :pt_br
in my .rb environment
What is missing?
source
share