1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #11861 from sadjow/improve-doc-translations-active-record-models

Add plural form example for AR I18n section [ci skip]
This commit is contained in:
José Valim 2013-08-13 01:21:45 -07:00
commit 620f41c9a4

View file

@ -731,6 +731,19 @@ en:
Then `User.model_name.human` will return "Dude" and `User.human_attribute_name("login")` will return "Handle". Then `User.model_name.human` will return "Dude" and `User.human_attribute_name("login")` will return "Handle".
You can also set a plural form for model names, adding as following:
```ruby
en:
activerecord:
models:
user:
one: Dude
other: Dudes
```
Then `User.model_name.human(:count => 2)` will return "Dudes". With `:count => 1` or without params will return "Dude".
#### Error Message Scopes #### Error Message Scopes
Active Record validation error messages can also be translated easily. Active Record gives you a couple of namespaces where you can place your message translations in order to provide different messages and translation for certain models, attributes, and/or validations. It also transparently takes single table inheritance into account. Active Record validation error messages can also be translated easily. Active Record gives you a couple of namespaces where you can place your message translations in order to provide different messages and translation for certain models, attributes, and/or validations. It also transparently takes single table inheritance into account.