Pluralization
suggest changeI18n can pluralize a translation when you pass count.
Set up the locale file like this. English uses one and other.
# config/locales/en.yml
en:
online_users:
one: "1 user is online"
other: "%{count} users are online"
Pass count to I18n.t:
I18n.t("online_users", count: 1)
#=> "1 user is online"
I18n.t("online_users", count: 4)
#=> "4 users are online"
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents