Fix pluralization logic IV
The problem
On the /notes/author/admin
page, the pluralization for research notes is incorrect:
https://user-images.githubusercontent.com/41092741/69304364-58504900-0bee-11ea-97c8-edb10e6a072d.png
Solution
When plugging in values that are subject to change, we need to make sure the text it'll generate is appropriate for both the singular and plural case.
-- lets find the relevant line of code first:
the text is generated here: https://github.com/publiclab/plots2/blob/a5d3392c3d6f5f4daaa56d5a4431e1bc0de5c46c/app/views/notes/index.html.erb#L14
with additional help from here: https://github.com/publiclab/plots2/blob/b3dc71222e3a1ce9e5417bc01c8b1e3c0d92f21f/config/locales/en.yml#L158-L159
There are many ways to fix this.
- I like this solution - "you can make use of the pluralization features of the
I18n
library by defining count values to translation keys". http://stackoverflow.com/questions/25064677/ddg#25065514 - But do it however! Just make sure your solution is DRY, as in sticks to using the locale helpers if this variable is used frequently throughout the repo, or a rails/ruby/etc. method that helps to handle this logic. No
if count == 1 ... else ....
here please as we have both "note(s)" and "edit(s)" to consider.
Requirements:
- DRY
- Accounts for both "note(s)" and "edit(s)"
Additional
Please find further information on installation / getting help on the linked issue!
Thank You 😊