diff --git a/app/main.ts b/app/main.ts index 550890fdb..f6b7b79b3 100644 --- a/app/main.ts +++ b/app/main.ts @@ -797,7 +797,8 @@ async function createWindow() { setupSpellChecker( mainWindow, getPreferredSystemLocales(), - getResolvedMessagesLocale().i18n + getResolvedMessagesLocale().i18n, + getLogger() ); if (!startInTray && windowConfig && windowConfig.maximized) { mainWindow.maximize(); diff --git a/app/spell_check.ts b/app/spell_check.ts index cd4d6f943..a5b61c691 100644 --- a/app/spell_check.ts +++ b/app/spell_check.ts @@ -11,6 +11,7 @@ import { maybeParseUrl } from '../ts/util/url'; import type { MenuListType } from '../ts/types/menu'; import type { LocalizerType } from '../ts/types/Util'; import { strictAssert } from '../ts/util/assert'; +import type { LoggerType } from '../ts/types/Logging'; export const FAKE_DEFAULT_LOCALE = 'en-x-ignore'; // -x- is an extension space for attaching other metadata to the locale @@ -55,9 +56,24 @@ export function getLanguages( export const setup = ( browserWindow: BrowserWindow, preferredSystemLocales: ReadonlyArray, - i18n: LocalizerType + i18n: LocalizerType, + logger: LoggerType ): void => { const { session } = browserWindow.webContents; + + session.on('spellcheck-dictionary-download-begin', (_event, lang) => { + logger.info('spellcheck: dictionary download begin:', lang); + }); + session.on('spellcheck-dictionary-download-failure', (_event, lang) => { + logger.error('spellcheck: dictionary download failure:', lang); + }); + session.on('spellcheck-dictionary-download-success', (_event, lang) => { + logger.info('spellcheck: dictionary download success:', lang); + }); + session.on('spellcheck-dictionary-initialized', (_event, lang) => { + logger.info('spellcheck: dictionary initialized:', lang); + }); + const availableLocales = session.availableSpellCheckerLanguages; const languages = getLanguages( preferredSystemLocales,