diff options
| author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-06-27 18:08:42 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-27 16:08:42 +0000 | 
| commit | 603c2c7e1b50d8b06c06848c3e83d241da9437e6 (patch) | |
| tree | 2e04bdb57475c630170315678d789751bfeb6444 /ext/js/display/display.js | |
| parent | 4e3f23e942252dacb31780de30f0233eccf1d9f8 (diff) | |
add lingua libre audio source (#1129)
* add lingua libre audio source
* mvp
* run file requests in parallel
* remove redundant language var
* redundant api function
---------
Co-authored-by: Cashew <52880648+cashewnuttynuts@users.noreply.github.com>
Diffstat (limited to 'ext/js/display/display.js')
| -rw-r--r-- | ext/js/display/display.js | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js index f86d7b8c..3d18e416 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -192,6 +192,8 @@ export class Display extends EventDispatcher {          this._onMenuButtonMenuCloseBind = this._onMenuButtonMenuClose.bind(this);          /** @type {ThemeController} */          this._themeController = new ThemeController(document.documentElement); +        /** @type {import('language').LanguageSummary[]} */ +        this._languageSummaries = [];          /* eslint-disable @stylistic/no-multi-spaces */          this._hotkeyHandler.registerActions([ @@ -316,6 +318,8 @@ export class Display extends EventDispatcher {              documentElement.dataset.browser = browser;          } +        this._languageSummaries = await this._application.api.getLanguageSummaries(); +          // Prepare          await this._hotkeyHelpController.prepare(this._application.api);          await this._displayGenerator.prepare(); @@ -398,6 +402,16 @@ export class Display extends EventDispatcher {      }      /** +     * @returns {import('language').LanguageSummary} +     * @throws {Error} +     */ +    getLanguageSummary() { +        if (this._options === null) { throw new Error('Options is null'); } +        const language = this._options.general.language; +        return /** @type {import('language').LanguageSummary} */ (this._languageSummaries.find(({iso}) => iso === language)); +    } + +    /**       * @returns {import('settings').OptionsContext}       */      getOptionsContext() {  |