mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Improve plural support for the matches counter
This commit is contained in:
parent
a85ee3616e
commit
f711dbc011
4 changed files with 59 additions and 40 deletions
|
@ -159,33 +159,31 @@ class PDFFindBar {
|
|||
}
|
||||
let matchesCountMsg = '', limit = MATCHES_COUNT_LIMIT;
|
||||
|
||||
if (total) {
|
||||
if (total > 0) {
|
||||
if (total > limit) {
|
||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {
|
||||
// TODO: Remove this hard-coded `[other]` form once plural support has
|
||||
// been implemented in the mozilla-central specific `l10n.js` file.
|
||||
matchesCountMsg = this.l10n.get('find_matches_count_limit[other]', {
|
||||
limit: limit.toLocaleString(),
|
||||
matchesCountMsg = this.l10n.get('find_match_count_limit[other]', {
|
||||
limit,
|
||||
}, 'More than {{limit}} matches');
|
||||
} else {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count_limit', {
|
||||
n: limit,
|
||||
limit: limit.toLocaleString(),
|
||||
matchesCountMsg = this.l10n.get('find_match_count_limit', {
|
||||
limit,
|
||||
}, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));
|
||||
}
|
||||
} else {
|
||||
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('MOZCENTRAL')) {
|
||||
// TODO: Remove this hard-coded `[other]` form once plural support has
|
||||
// been implemented in the mozilla-central specific `l10n.js` file.
|
||||
matchesCountMsg = this.l10n.get('find_matches_count[other]', {
|
||||
current: current.toLocaleString(),
|
||||
total: total.toLocaleString(),
|
||||
matchesCountMsg = this.l10n.get('find_match_count[other]', {
|
||||
current,
|
||||
total,
|
||||
}, '{{current}} of {{total}} matches');
|
||||
} else {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count', {
|
||||
n: total,
|
||||
current: current.toLocaleString(),
|
||||
total: total.toLocaleString(),
|
||||
matchesCountMsg = this.l10n.get('find_match_count', {
|
||||
current,
|
||||
total,
|
||||
}, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue