Add a new getLanguage
method to the various IL10n
implementations
This commit is contained in:
parent
ab74b32054
commit
513412c92e
@ -145,6 +145,10 @@ class MozL10n {
|
||||
this.mozL10n = mozL10n;
|
||||
}
|
||||
|
||||
getLanguage() {
|
||||
return Promise.resolve(this.mozL10n.getLanguage());
|
||||
}
|
||||
|
||||
getDirection() {
|
||||
return Promise.resolve(this.mozL10n.getDirection());
|
||||
}
|
||||
|
@ -27,6 +27,12 @@ class GenericL10n {
|
||||
});
|
||||
}
|
||||
|
||||
getLanguage() {
|
||||
return this._ready.then((l10n) => {
|
||||
return l10n.getLanguage();
|
||||
});
|
||||
}
|
||||
|
||||
getDirection() {
|
||||
return this._ready.then((l10n) => {
|
||||
return l10n.getDirection();
|
||||
|
@ -160,6 +160,11 @@ class IPDFAnnotationLayerFactory {
|
||||
* @interface
|
||||
*/
|
||||
class IL10n {
|
||||
/**
|
||||
* @returns {Promise<string>} - Resolves to the current locale.
|
||||
*/
|
||||
getLanguage() {}
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>} - Resolves to 'rtl' or 'ltr'.
|
||||
*/
|
||||
|
@ -58,6 +58,10 @@ function formatL10nValue(text, args) {
|
||||
* @implements {IL10n}
|
||||
*/
|
||||
let NullL10n = {
|
||||
getLanguage() {
|
||||
return Promise.resolve('en-us');
|
||||
},
|
||||
|
||||
getDirection() {
|
||||
return Promise.resolve('ltr');
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user