I18n with arguments

suggest change

You can pass parameters to the I18n t method:

# config/locales/en.yml
en:
  page:
    users: "%{users_count} users currently online"
# In models, controllers, and elsewhere
I18n.t("page.users", users_count: 12)
# => "12 users currently online"
<%= t("page.users", users_count: 12) %>
= t("page.users", users_count: 12)

A leading dot is a lazy lookup, scoped to the current template. In app/views/page/users.html.erb, t(".users") looks up page.users.users, not page.users. For the YAML above, call t("page.users"), or call t(".") from that template. t(".") uses the template scope itself.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents