Bug 27325 - Fix singular/plural forms on the OPAC dashboard
Summary: Fix singular/plural forms on the OPAC dashboard
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 26123
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-03 14:34 UTC by Katrin Fischer
Modified: 2021-12-13 21:08 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00


Attachments
Bug 27325: Fix singular/plural forms on the OPAC dashboard (7.47 KB, patch)
2021-01-06 17:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27325: Fix singular/plural forms on the OPAC dashboard (7.51 KB, patch)
2021-01-11 12:17 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27325: Fix singular/plural forms on the OPAC dashboard (7.57 KB, patch)
2021-01-11 15:28 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 27325: Fix singular/plural forms on the OPAC dashboard (7.62 KB, patch)
2021-01-12 22:34 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2021-01-03 14:34:34 UTC
At the moment the dashboard panel on the OPAC start page uses "checkout(s)", "overdue(s)", "hold(s)" etc.

We have the tools now to deal with these in a nicer way, showing "1 hold" and "2 holds" and deal with these nicely in translations as well.

For documentation see:
https://wiki.koha-community.org/wiki/Internationalization,_plural_forms,_context,_and_more_RFC

For an example see the result list on the staff side:

https://git.koha-community.org/Koha-community/Koha/src/branch/master/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt#L535

[% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %]
Comment 1 David Cook 2021-01-04 00:38:37 UTC
Why not use something like the following instead?

Checkouts: [% checkouts.count %]
Overdues: [% overdues.count %]
Holds: [% holds.count %]
Comment 2 Katrin Fischer 2021-01-04 08:06:02 UTC
We could, but are we sure that this is nice in every language? I think using the singular/plural feature in such a prominent place would make sense and look good :)
Comment 3 David Cook 2021-01-04 23:42:28 UTC
(In reply to Katrin Fischer from comment #2)
> We could, but are we sure that this is nice in every language? I think using
> the singular/plural feature in such a prominent place would make sense and
> look good :)

I disagree about the singular/plural feature but that's OK. As for appropriateness for every language, I think avoiding singular/plural is more likely to be better for every language. 

I like the advice at https://developer.atlassian.com/server/framework/atlassian-sdk/pluralising-internationalisation-strings/

Considering that Atlassian has about 10 million active users of its products internationally in 190+ countries (https://www.atlassian.com/customers), I think it would be wise to listen to their advice. 

But that's just my 2 cents and I know I'm in the minority in this view. I figured I'd just reiterate it anyway.
Comment 4 Owen Leonard 2021-01-06 17:37:20 UTC
Created attachment 114899 [details] [review]
Bug 27325: Fix singular/plural forms on the OPAC dashboard

This patch adds handling of plurals to the display of counts on the
logged-in user's dashboard: checkouts, overdues, etc.

To test, apply the patch and log in to the OPAC.

 - Go to the OPAC main page and check the user dashboard area.
 - Confirm that the correct numbers and plural forms are shown for
   checkouts, overdues, holds pending, holds waiting, and messages.
 - Test each of those categories with counts of 0, 1, and more than one
   to confirm that the plural forms are correct.
 - Test with various counts of each type of message: OPAC notes as
   defined when editing a patron record and notes added via the checkout
   page.
Comment 5 Lucas Gass 2021-01-08 22:07:10 UTC
This works good and it looks good. I think this is much cleaner looking than the  with the (s). 
The plural and singular forms all work well for checkouts, overdues, holds pending, holds waiting, and messages. 


The template is missing some filters though:


 FAIL	koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
   FAIL	  filters
		missing_filter at line 225 (                                                [% tn('checkout', 'checkouts', checkouts ) %])
		missing_filter at line 233 (                                                [% tn('overdue', 'overdues', overdues ) %])
		missing_filter at line 241 (                                                [% tn('hold pending', 'holds pending', holds_pending ) %])
		missing_filter at line 249 (                                                [% tn('hold waiting', 'holds waiting', holds_waiting ) %])
		missing_filter at line 266 (                                                    [% tn('message', 'messages', patron_messages.count + 1 ) %])
		missing_filter at line 273 (                                                    [% tn('message', 'messages', patron_messages.count ) %])
Comment 6 Owen Leonard 2021-01-11 12:17:11 UTC
Created attachment 115015 [details] [review]
Bug 27325: Fix singular/plural forms on the OPAC dashboard

This patch adds handling of plurals to the display of counts on the
logged-in user's dashboard: checkouts, overdues, etc.

To test, apply the patch and log in to the OPAC.

 - Go to the OPAC main page and check the user dashboard area.
 - Confirm that the correct numbers and plural forms are shown for
   checkouts, overdues, holds pending, holds waiting, and messages.
 - Test each of those categories with counts of 0, 1, and more than one
   to confirm that the plural forms are correct.
 - Test with various counts of each type of message: OPAC notes as
   defined when editing a patron record and notes added via the checkout
   page.
Comment 7 Lucas Gass 2021-01-11 15:28:12 UTC
Created attachment 115037 [details] [review]
Bug 27325: Fix singular/plural forms on the OPAC dashboard

This patch adds handling of plurals to the display of counts on the
logged-in user's dashboard: checkouts, overdues, etc.

To test, apply the patch and log in to the OPAC.

 - Go to the OPAC main page and check the user dashboard area.
 - Confirm that the correct numbers and plural forms are shown for
   checkouts, overdues, holds pending, holds waiting, and messages.
 - Test each of those categories with counts of 0, 1, and more than one
   to confirm that the plural forms are correct.
 - Test with various counts of each type of message: OPAC notes as
   defined when editing a patron record and notes added via the checkout
   page.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Katrin Fischer 2021-01-12 22:34:45 UTC
Created attachment 115102 [details] [review]
Bug 27325: Fix singular/plural forms on the OPAC dashboard

This patch adds handling of plurals to the display of counts on the
logged-in user's dashboard: checkouts, overdues, etc.

To test, apply the patch and log in to the OPAC.

 - Go to the OPAC main page and check the user dashboard area.
 - Confirm that the correct numbers and plural forms are shown for
   checkouts, overdues, holds pending, holds waiting, and messages.
 - Test each of those categories with counts of 0, 1, and more than one
   to confirm that the plural forms are correct.
 - Test with various counts of each type of message: OPAC notes as
   defined when editing a patron record and notes added via the checkout
   page.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2021-01-13 16:20:00 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-01-18 14:46:49 UTC
Depends on Bug 26123 not in 20.11.x