mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Wraps mozL10n to async calls; splits firefox and generic l10n libs.
This commit is contained in:
parent
09d46e94c6
commit
5438ce9b98
28 changed files with 463 additions and 260 deletions
|
@ -13,6 +13,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import '../extensions/firefox/tools/l10n';
|
||||
import { createObjectURL, PDFDataRangeTransport, shadow } from 'pdfjs-lib';
|
||||
import { BasePreferences } from './preferences';
|
||||
import { PDFViewerApplication } from './app';
|
||||
|
@ -141,6 +142,25 @@ class FirefoxPreferences extends BasePreferences {
|
|||
}
|
||||
}
|
||||
|
||||
class MozL10n {
|
||||
constructor(mozL10n) {
|
||||
this.mozL10n = mozL10n;
|
||||
}
|
||||
|
||||
getDirection() {
|
||||
return Promise.resolve(this.mozL10n.getDirection());
|
||||
}
|
||||
|
||||
get(property, args, fallback) {
|
||||
return Promise.resolve(this.mozL10n.get(property, args, fallback));
|
||||
}
|
||||
|
||||
translate(element) {
|
||||
this.mozL10n.translate(element);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
(function listenFindEvents() {
|
||||
var events = [
|
||||
'find',
|
||||
|
@ -250,6 +270,12 @@ PDFViewerApplication.externalServices = {
|
|||
return new FirefoxPreferences();
|
||||
},
|
||||
|
||||
createL10n() {
|
||||
var mozL10n = document.mozL10n;
|
||||
// TODO refactor mozL10n.setExternalLocalizerServices
|
||||
return new MozL10n(mozL10n);
|
||||
},
|
||||
|
||||
get supportsIntegratedFind() {
|
||||
var support = FirefoxCom.requestSync('supportsIntegratedFind');
|
||||
return shadow(this, 'supportsIntegratedFind', support);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue