I am new to rails, and i am working on a rtl website! I am trying to fix the pluralization in comment.count and get_upvotes.size to be replaced by the other language words. I have heard that I can do it with Rails Internationalization (I18n) but I could not find a clear answer to my question.
Here's my code in the show.html.erb page:
#post_show
%h1= @post.title
%p.username
before
= time_ago_in_words(@post.created_at)
.clearfix
.post_image_description
= image_tag @post.image.url(:medium)
.description= simple_format(@post.description)
.post_data
= link_to "Project link", @post.link, class: "btn btn-warning btn-block"
= link_to like_post_path(@post), method: :get, class: "data" do
%i.fa.fa-check
= pluralize(@post.get_upvotes.size, "Like")
%p.data
%i.fa.fa-comments.o
= pluralize(@post.comments.count, "Comment")
- if @post.user == current_user
= link_to "Edit", edit_post_path(@post), class: "data"
= link_to "Delete", post_path(@post), method: :delete, data: { confirm: "Sure?" },class: "data"
Now all I need is to cancel the pluralization so when 2 comments or more shows up it does not pluralize and change to comments. Instead it stays the same as comment
I would appreciate the help. Let me know if more information is needed! Thanks
Aucun commentaire:
Enregistrer un commentaire