From b911ebfd076c3cd81609140eb0d49c5cff4ec51e Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Wed, 8 Jun 2016 22:03:40 -0300 Subject: [PATCH] Replace pluralize calls --- app/helpers/crops_helper.rb | 2 +- app/views/forums/index.html.haml | 2 +- app/views/gardens/_thumbnail.html.haml | 2 +- app/views/gardens/show.html.haml | 2 +- app/views/members/_gardens.html.haml | 2 +- app/views/members/_stats.html.haml | 10 +++++----- app/views/members/_thumbnail.html.haml | 2 +- app/views/posts/_comments.html.haml | 2 +- app/views/posts/_single.html.haml | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/helpers/crops_helper.rb b/app/helpers/crops_helper.rb index 1afae6bb7..b3db794c9 100644 --- a/app/helpers/crops_helper.rb +++ b/app/helpers/crops_helper.rb @@ -13,7 +13,7 @@ module CropsHelper end if (total_quantity != 0) - "You have #{pluralize(total_quantity, "seed")} of this crop." + "You have #{total_quantity} #{Seed.model_name.human(:count => total_quantity)} of this crop." else "You have an unknown quantity of seeds of this crop." end diff --git a/app/views/forums/index.html.haml b/app/views/forums/index.html.haml index 25649f937..39b4f269d 100644 --- a/app/views/forums/index.html.haml +++ b/app/views/forums/index.html.haml @@ -7,7 +7,7 @@ - @forums.each do |forum| %h2= forum %p - = pluralize(forum.posts.size, "post") + = localize_plural(forum.posts, Post) | =link_to "Visit forum", forum | diff --git a/app/views/gardens/_thumbnail.html.haml b/app/views/gardens/_thumbnail.html.haml index e831dc986..ef9209802 100644 --- a/app/views/gardens/_thumbnail.html.haml +++ b/app/views/gardens/_thumbnail.html.haml @@ -25,7 +25,7 @@ %dd= garden.active ? "Yes" : "No" .col-md-12 %b - = "#{pluralize(garden.plantings.size, "Planting")} : " + = "#{localize_plural(garden.plantings, Planting)} : " = display_garden_plantings(garden.plantings.current) - if garden.plantings.size > 2 %br diff --git a/app/views/gardens/show.html.haml b/app/views/gardens/show.html.haml index fb5eeae12..882f0dfde 100644 --- a/app/views/gardens/show.html.haml +++ b/app/views/gardens/show.html.haml @@ -47,7 +47,7 @@ - if @garden.photos.size > 0 or (can? :edit, @garden and can? :create, Photo) .row-fluid %h3 Photos - %p= pluralize(@garden.photos.length, "photo") + %p= localize_plural(@garden.photos, Photo) .row-fluid %ul.thumbnails - @garden.photos.each do |p| diff --git a/app/views/members/_gardens.html.haml b/app/views/members/_gardens.html.haml index ad40fda9a..cfb5e22cb 100644 --- a/app/views/members/_gardens.html.haml +++ b/app/views/members/_gardens.html.haml @@ -33,7 +33,7 @@ - if g.photos.size > 0 or (can? :edit, g and can? :create, Photo) .row %h3 Photos - %p= pluralize(g.photos.length, "photo") + %p= localize_plural(g.photos, Photo) .row %ul.thumbnails - g.photos.each do |p| diff --git a/app/views/members/_stats.html.haml b/app/views/members/_stats.html.haml index 26635e2f1..80d857004 100644 --- a/app/views/members/_stats.html.haml +++ b/app/views/members/_stats.html.haml @@ -3,28 +3,28 @@ %ul.list-inline %li - if member.plantings.size > 0 - = link_to pluralize(member.plantings.size, "planting"), plantings_by_owner_path(:owner => member) + = link_to localize_plural(member.plantings, Planting), plantings_by_owner_path(:owner => member) - else 0 plantings %li - if member.harvests.size > 0 - = link_to pluralize(member.harvests.size, "harvest"), harvests_by_owner_path(:owner => member) + = link_to localize_plural(member.harvests, Harvest), harvests_by_owner_path(:owner => member) - else 0 harvests %li - if member.seeds.size > 0 - = link_to pluralize(member.seeds.size, "seeds"), seeds_by_owner_path(:owner => member) + = link_to localize_plural(member.seeds, Seed), seeds_by_owner_path(:owner => member) - else 0 seeds %li - if member.posts.size > 0 - = link_to pluralize(member.posts.size, "post"), posts_by_author_path(:author => member) + = link_to localize_plural(member.posts, Post), posts_by_author_path(:author => member) - else 0 posts %li - if member.followed.size > 0 - = link_to pluralize(member.followed.size, "follow"), member_follows_path(member) + = link_to localize_plural(member.followed, Follow), member_follows_path(member) - else 0 following diff --git a/app/views/members/_thumbnail.html.haml b/app/views/members/_thumbnail.html.haml index a55c34e50..af3330ca7 100644 --- a/app/views/members/_thumbnail.html.haml +++ b/app/views/members/_thumbnail.html.haml @@ -21,4 +21,4 @@ ago. %p %small - = [pluralize(member.gardens.size, "garden"), pluralize(member.plantings.size, "planting"), pluralize(member.seeds.size, "seed")].join(", ") + = [localize_plural(member.gardens, Garden), localize_plural(member.plantings, Planting), localize_plural(member.seeds, Seed)].join(", ") diff --git a/app/views/posts/_comments.html.haml b/app/views/posts/_comments.html.haml index 78375ab00..8e3e7ce9c 100644 --- a/app/views/posts/_comments.html.haml +++ b/app/views/posts/_comments.html.haml @@ -1,7 +1,7 @@ %a{:name => "comments"} - if post.comments %h2 - =pluralize(post.comments.size, "comment") + =localize_plural(post.comments, Comment) - post.comments.post_order.each do |c| = render :partial => "comments/single", :locals => { :comment => c } diff --git a/app/views/posts/_single.html.haml b/app/views/posts/_single.html.haml index 3ba1e6194..489f81a58 100644 --- a/app/views/posts/_single.html.haml +++ b/app/views/posts/_single.html.haml @@ -27,7 +27,7 @@ - unless defined?(hide_comments) .post-comments %ul.list-inline - %li.first= link_to pluralize(post.comments.size, "comment"), + %li.first= link_to localize_plural(post.comments, Comment), post_path(post, :anchor => 'comments') -if can? :create, Comment %li= link_to "Reply", new_comment_path(:post_id => post.id)