From 56f85ef661b1c7547fe1baf3971f74ad053ce1fc Mon Sep 17 00:00:00 2001 From: sienori Date: Thu, 7 Jan 2021 19:09:12 +0900 Subject: [PATCH] Rename specified key to modifier key --- src/_locales/en/messages.json | 15 ++++++--------- src/content/index.js | 8 ++++---- src/settings/defaultSettings.js | 14 +++++++------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index adb9a7d..bdd1757 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -95,17 +95,14 @@ "isDisabledInTextFieldsCaptionLabel": { "message": "Don't display translation button or panel when selecting text in a text field." }, - "ifOnlyTranslateWhenShiftPressedLabel": { - "message": "Translate on specified key pressed" + "ifOnlyTranslateWhenModifierKeyPressedLabel": { + "message": "Translate on modifier key pressed" }, - "ifOnlyTranslateWhenShiftPressedCaptionLabel": { - "message": "Only display translation on Shift key pressed" + "ifOnlyTranslateWhenModifierKeyPressedCaptionLabel": { + "message": "Only display translation on specified modifier key pressed" }, - "specifiedKeyLabel": { - "message": "Specified Key" - }, - "specifyKeyLabel": { - "message": "Specify Key" + "modifierKeyLabel": { + "message": "Modifier Key" }, "shiftLabel": { "message": "Shift" diff --git a/src/content/index.js b/src/content/index.js index cabff64..e112202 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -38,9 +38,9 @@ const handleMouseUp = async e => { if (isInContentEditable()) return; } - if (getSettings("ifOnlyTranslateWhenShiftPressed")) { - const spKey = getSettings("specifiedKey") - switch(spKey){ + if (getSettings("ifOnlyTranslateWhenModifierKeyPressed")) { + const modifierKey = getSettings("modifierKey"); + switch (modifierKey) { case "shift": if (!e.shiftKey) return; break; @@ -54,7 +54,7 @@ const handleMouseUp = async e => { if (!e.metaKey) return; break; default: - break; + break; } } diff --git a/src/settings/defaultSettings.js b/src/settings/defaultSettings.js index da9ca8d..885f34f 100644 --- a/src/settings/defaultSettings.js +++ b/src/settings/defaultSettings.js @@ -88,20 +88,20 @@ export default [ ] }, { - title: "specifiedKeyLabel", + title: "modifierKeyLabel", captions: [], type: "none", - childElements:[ + childElements: [ { - id: "ifOnlyTranslateWhenShiftPressed", - title: "ifOnlyTranslateWhenShiftPressedLabel", - captions: ["ifOnlyTranslateWhenShiftPressedCaptionLabel"], + id: "ifOnlyTranslateWhenModifierKeyPressed", + title: "ifOnlyTranslateWhenModifierKeyPressedLabel", + captions: ["ifOnlyTranslateWhenModifierKeyPressedCaptionLabel"], type: "checkbox", default: false }, { - id: "specifiedKey", - title: "specifiedKeyLabel", + id: "modifierKey", + title: "modifierKeyLabel", captions: [], type: "select", default: "shift",