Add ignored document lang option (#265)
This option allows you to list the locales for which you do not need to apply translation.
This commit is contained in:
parent
6612e49710
commit
7c953f8244
|
@ -137,6 +137,12 @@
|
||||||
"secondTargetLangCaptionLabel": {
|
"secondTargetLangCaptionLabel": {
|
||||||
"message": "Select the second target language."
|
"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": {
|
"waitTimeLabel": {
|
||||||
"message": "Waiting time to translate"
|
"message": "Waiting time to translate"
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,8 +28,12 @@ const handleMouseUp = async e => {
|
||||||
if (!isLeftClick) return;
|
if (!isLeftClick) return;
|
||||||
if (isInPasswordField) return;
|
if (isInPasswordField) return;
|
||||||
if (isInThisElement) return;
|
if (isInThisElement) return;
|
||||||
|
|
||||||
removeTranslatecontainer();
|
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();
|
const selectedText = getSelectedText();
|
||||||
prevSelectedText = selectedText;
|
prevSelectedText = selectedText;
|
||||||
if (selectedText.length === 0) return;
|
if (selectedText.length === 0) return;
|
||||||
|
|
|
@ -39,6 +39,15 @@ export default [
|
||||||
options: langListOptions,
|
options: langListOptions,
|
||||||
useRawOptionName: true
|
useRawOptionName: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "ignoredDocumentLang",
|
||||||
|
title: "ignoredDocumentLangLabel",
|
||||||
|
captions: ["ignoredDocumentLangCaptionLabel"],
|
||||||
|
type: "text",
|
||||||
|
default: "",
|
||||||
|
placeholder: "en, ru, ch",
|
||||||
|
new: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "ifShowCandidate",
|
id: "ifShowCandidate",
|
||||||
title: "ifShowCandidateLabel",
|
title: "ifShowCandidateLabel",
|
||||||
|
|
Loading…
Reference in a new issue