Tweak the matchCount l10n-args handling slightly (PR 17146 follow-up)

Given that providing unused parameters in the l10n-args shouldn't be a problem, let's simplify the relevant JavaScript code a tiny bit.
This commit is contained in:
Jonas Jenwald 2023-10-24 13:17:02 +02:00
parent e2af77fd6c
commit bcb01e5e2b

View File

@ -144,16 +144,15 @@ class PDFFindBar {
const { findResultsCount } = this; const { findResultsCount } = this;
if (total > 0) { if (total > 0) {
const limit = MATCHES_COUNT_LIMIT, const limit = MATCHES_COUNT_LIMIT;
isLimited = total > limit;
findResultsCount.setAttribute( findResultsCount.setAttribute(
"data-l10n-id", "data-l10n-id",
`pdfjs-find-match-count${isLimited ? "-limit" : ""}` `pdfjs-find-match-count${total > limit ? "-limit" : ""}`
); );
findResultsCount.setAttribute( findResultsCount.setAttribute(
"data-l10n-args", "data-l10n-args",
JSON.stringify(isLimited ? { limit } : { current, total }) JSON.stringify({ limit, current, total })
); );
} else { } else {
findResultsCount.removeAttribute("data-l10n-id"); findResultsCount.removeAttribute("data-l10n-id");