From 23c5d6d9ad704e488e685c34e158255a7d3278f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sadjow=20Le=C3=A3o?= Date: Tue, 13 Aug 2013 00:06:03 -0300 Subject: [PATCH] Add plural form example for AR I18n section [ci skip] --- guides/source/i18n.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/guides/source/i18n.md b/guides/source/i18n.md index facfb96d98..e4214fd74e 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -731,6 +731,19 @@ en: 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 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.