Hard-code the MOZCENTRAL
build to use the [other]
plural forms of the matcheCount strings, to prevent errors for PDF files embedded in iframe/object tags
The built-in PDF Viewer (in Firefox) cannot use the browser findbar when PDF files are embedded in e.g. iframe/object tags, and the PDF.js findbar (i.e. `PDFFindBar`) will thus be used instead in those cases. This is slightly problematic, since the `MOZCENTRAL` version of the viewer uses a special, slimmed down, version of the `l10n.js` file that doesn't (currently) support plural forms. To prevent the matchesCounter from breaking completely in this edge-case, temporarily hard-code the plural form to use the default `[other]` version of the locale strings.
This commit is contained in:
parent
be7fdf148c
commit
06b9455263
@ -161,16 +161,33 @@ class PDFFindBar {
|
||||
|
||||
if (total) {
|
||||
if (total > limit) {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count_limit', {
|
||||
n: limit,
|
||||
limit: limit.toLocaleString(),
|
||||
}, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));
|
||||
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(),
|
||||
}, 'More than {{limit}} matches');
|
||||
} else {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count_limit', {
|
||||
n: limit,
|
||||
limit: limit.toLocaleString(),
|
||||
}, 'More than {{limit}} match' + (limit !== 1 ? 'es' : ''));
|
||||
}
|
||||
} else {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count', {
|
||||
n: total,
|
||||
current: current.toLocaleString(),
|
||||
total: total.toLocaleString(),
|
||||
}, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));
|
||||
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(),
|
||||
}, '{{current}} of {{total}} matches');
|
||||
} else {
|
||||
matchesCountMsg = this.l10n.get('find_matches_count', {
|
||||
n: total,
|
||||
current: current.toLocaleString(),
|
||||
total: total.toLocaleString(),
|
||||
}, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
Promise.resolve(matchesCountMsg).then((msg) => {
|
||||
|
Loading…
Reference in New Issue
Block a user