From 09722e0853a917bcced5f7443543404b8592c7eb Mon Sep 17 00:00:00 2001 From: jamesmaa Date: Thu, 17 Oct 2024 10:08:57 -0700 Subject: [PATCH] Fix french text replacements --- ext/data/recommended-settings.json | 26 +++++++++++++++++++ .../recommended-settings-controller.js | 12 +++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ext/data/recommended-settings.json b/ext/data/recommended-settings.json index dcb0925701..298f42cf70 100644 --- a/ext/data/recommended-settings.json +++ b/ext/data/recommended-settings.json @@ -51,6 +51,32 @@ "value": "word" }, "description": "Lookup whole words in the dictionary." + }, + { + "modification": { + "action": "set", + "path": "translation.textReplacements.groups", + "value": [ + [ + { + "pattern": "l'", + "ignoreCase": true, + "replacement": "" + }, + { + "pattern": "j'", + "ignoreCase": true, + "replacement": "" + }, + { + "pattern": "d'", + "ignoreCase": true, + "replacement": "" + } + ] + ] + }, + "description": "Separating the l', j', d' from the word." } ] } diff --git a/ext/js/pages/settings/recommended-settings-controller.js b/ext/js/pages/settings/recommended-settings-controller.js index 1eba2ad117..65ab53bde9 100644 --- a/ext/js/pages/settings/recommended-settings-controller.js +++ b/ext/js/pages/settings/recommended-settings-controller.js @@ -94,7 +94,15 @@ export class RecommendedSettingsController { if (typeof setting === 'undefined') { continue; } modifications.push(setting.modification); } - void this._settingsController.modifyProfileSettings(modifications); + void this._settingsController.modifyProfileSettings(modifications).then( + (results) => { + results.map((result) => { + if (Object.hasOwn(result, 'error')) { + log.error(new Error(`Failed to apply recommended setting: ${JSON.stringify(result)}`)); + } + }); + }, + ); void this._settingsController.refresh(); } this._recommendedSettingsModal.hidden = true; @@ -114,7 +122,7 @@ export class RecommendedSettingsController { const pathCodeElement = document.createElement('code'); pathCodeElement.textContent = path; const valueCodeElement = document.createElement('code'); - valueCodeElement.textContent = String(value); + valueCodeElement.textContent = JSON.stringify(value, null, 2); label.appendChild(document.createTextNode('Setting ')); label.appendChild(pathCodeElement);