Reputation: 5197
Please let me explain what I've done first.
I installed the gem rails-i18n
then I did rails g i18n es command
It generated translated_es.yml
Models names and their column names are in there so I translated like this.
Then I restarted my server to check if it applied, but it's not. why? I tried to submit a form with empty field.
I see validation error message, but the column name is in English. How can I fix this?
es:
activerecord:
models:
acts_as_taggable_on/tag: acts_as_taggable_on/tag #g
acts_as_taggable_on/tagging: acts_as_taggable_on/tagging #g
acts_as_votable/vote: acts_as_votable/vote #g
comment: comentario #g
community: comunidad #g
[...]
Upvotes: 1
Views: 112
Reputation: 2273
Try this,
es:
activerecord:
models:
community: "comunidad"
comment: "comentario"
attributes:
"community":
title: "titulo"
"comment":
title: "titulo"
[...]
Give two spaces for each and do not give tabs... Try and let know...
After edited you need to restart the server.
Upvotes: 1
Reputation: 4157
Set the default, as well as the current language in your config/application.rb
:
config.i18n.default_locale = config.i18n.locale = :es
Upvotes: 0
Reputation: 5929
First of all you have to switch you current locale. In case your project supports only one language you can put
I18n.locale = :es
into one of your initializers.
If this locale file are nested in some directory inside config/locales
you should load nested directories inside application.rb
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
Upvotes: 0