Reputation: 7635
I have got a model, that is called vehicle.
In my translation the model must be: vehicle => Fahrzeug vehicles => Fahrzeuge
I tried to set this in the locales file, but it did not work:
activerecord:
models:
vehicle: Fahrzeug
vehicles: Fahrzeuge
Upvotes: 13
Views: 6030
Reputation: 8668
ActiveRecord first translates the model name using I18n.translate with default
:count => 1
Pluralizing this string afterwards dosn't know about model translations.
But, human accepts options so
Vehicle.model_name.human(:count => 2)
does the trick together with pluralized translations:
de:
activerecord:
models:
vehicle:
one: 'Fahrzeug'
other: 'Fahrzeuge'
Upvotes: 31
Reputation: 18845
you are just one step away: http://guides.rubyonrails.org/i18n.html#pluralization
activerecord:
models:
vehicle:
one: Fahrzeug
many: Fahrzeuge
in rails 4 this seems to be changed from many
to other
en:
activerecord:
models:
user:
one: Dude
other: Dudes
Upvotes: 0
Reputation: 10215
Have you tried other
instead of many
? That worked for me at least. I am on Rails 3.2.3.
Upvotes: -1