Bug 27325

Summary: Fix singular/plural forms on the OPAC dashboard
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: caroline.cyr-la-rose, dcook, fridolin.somers, jonathan.druart, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00
Bug Depends on: 26123    
Bug Blocks:    
Attachments: Bug 27325: Fix singular/plural forms on the OPAC dashboard
Bug 27325: Fix singular/plural forms on the OPAC dashboard
Bug 27325: Fix singular/plural forms on the OPAC dashboard
Bug 27325: Fix singular/plural forms on the OPAC dashboard

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