diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 3d1128b..acf2fe1 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -137,6 +137,12 @@ "secondTargetLangCaptionLabel": { "message": "Select the second target language." }, + "ignoredDocumentLangLabel": { + "message": "Ignore documents in the following languages" + }, + "ignoredDocumentLangCaptionLabel": { + "message": "Comma separated languages that do not need to be translated." + }, "waitTimeLabel": { "message": "Waiting time to translate" }, @@ -359,4 +365,4 @@ "openPopupDescription": { "message": "Open toolbar popup" } -} \ No newline at end of file +} diff --git a/src/content/index.js b/src/content/index.js index e112202..c2caa28 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -28,8 +28,12 @@ const handleMouseUp = async e => { if (!isLeftClick) return; if (isInPasswordField) return; if (isInThisElement) return; + removeTranslatecontainer(); + const ignoredDocumentLang = getSettings('ignoredDocumentLang').split(',').map(s => s.trim()).filter(s => !!s) + if (!!document.documentElement.lang && ignoredDocumentLang.includes(document.documentElement.lang)) return; + const selectedText = getSelectedText(); prevSelectedText = selectedText; if (selectedText.length === 0) return; diff --git a/src/settings/defaultSettings.js b/src/settings/defaultSettings.js index cb5690b..9c0c26e 100644 --- a/src/settings/defaultSettings.js +++ b/src/settings/defaultSettings.js @@ -39,6 +39,15 @@ export default [ options: langListOptions, useRawOptionName: true }, + { + id: "ignoredDocumentLang", + title: "ignoredDocumentLangLabel", + captions: ["ignoredDocumentLangCaptionLabel"], + type: "text", + default: "", + placeholder: "en, ru, ch", + new: true, + }, { id: "ifShowCandidate", title: "ifShowCandidateLabel",