Question

irb(main):023:0> article.impressions_count
=> 26

In the article show view I have:

<%= t(".impressions", :impressions => @article.impressions_count) %>

I would like pluralize with something like this on my es.yml file:

impressions:
 one: "%{impressions} visualización"
 other: "%{impressions} visualizaciones"

However I get:

{:one=>"%{impressions} visualización", :other=>"%{impressions} visualizaciones"}

How can I pluralize the article impressions_count attribute?

Thanks!

Was it helpful?

Solution

Instead :impressions, pass :count as a key

<%= t(".impressions", count: @article.impressions_count) %>

one: "%{count} visualización"
other: "%{count} visualizaciones"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top