https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43843

--- Comment #14 from Jonathan Druart <[email protected]> ---
Created attachment 209525
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209525&action=edit
Bug 43843: Coerce the count to a number in i18n.js

Tannin evaluates the Plural-Forms expression with strict equality: with
the plural rule "n != 1", the string "1" is not equal to the number 1,
so the plural form is returned. Gettext.js evaluated the expression as
JavaScript, where "1" != 1 is false.

Some callers give the count as a string, for instance the ERM dashboard
widget (ERMCounts.vue), which passes the "X-Total-Count" header value to
__nx. In languages with the "n != 1" plural rule (de, es, it, nl...), a
single agreement would be displayed with the plural form.

Convert the count with Number() in i18n.js, so that all the callers are
covered.

Test plan:
1. Run the Cypress test:
   yarn cypress run --spec t/cypress/integration/i18n_spec.ts
   => "Accepts a count given as a string" passes. Without the change to
      i18n.js, it fails for the count "1".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

Signed-off-by: Jonathan Druart <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to