diff --git a/ext/js/pages/settings/languages-controller.js b/ext/js/pages/settings/languages-controller.js index befda65a15..7556350977 100755 --- a/ext/js/pages/settings/languages-controller.js +++ b/ext/js/pages/settings/languages-controller.js @@ -56,16 +56,16 @@ export class LanguagesController { async _updateOptions() { const options = await this._settingsController.getOptions(); const {general: {language}} = options; + if (!options.languages[language]) { + /** @type {import('settings').LanguageOptions} */ + const defaultOptions = { + textPreprocessors: {} + }; await this._settingsController.modifyProfileSettings([{ action: 'set', - path: 'languages', - value: { - ...options.languages, - [language]: { - textPreprocessors: {} - } - } + path: `languages[${JSON.stringify(language)}]`, + value: defaultOptions }]); } } diff --git a/types/ext/settings.d.ts b/types/ext/settings.d.ts index 623f66b1d7..1a740ed2ab 100644 --- a/types/ext/settings.d.ts +++ b/types/ext/settings.d.ts @@ -348,7 +348,7 @@ export type TextPreprocessorsOptions = { }; export type LanguageOptions = { - textPreprocessors?: TextPreprocessorsOptions; + textPreprocessors: TextPreprocessorsOptions; }; export type LanguageOptionsObjectMap = {