Rename specified key to modifier key

This commit is contained in:
sienori 2021-01-07 19:09:12 +09:00
parent a6db23f5fb
commit 56f85ef661
3 changed files with 17 additions and 20 deletions

View file

@ -95,17 +95,14 @@
"isDisabledInTextFieldsCaptionLabel": { "isDisabledInTextFieldsCaptionLabel": {
"message": "Don't display translation button or panel when selecting text in a text field." "message": "Don't display translation button or panel when selecting text in a text field."
}, },
"ifOnlyTranslateWhenShiftPressedLabel": { "ifOnlyTranslateWhenModifierKeyPressedLabel": {
"message": "Translate on specified key pressed" "message": "Translate on modifier key pressed"
}, },
"ifOnlyTranslateWhenShiftPressedCaptionLabel": { "ifOnlyTranslateWhenModifierKeyPressedCaptionLabel": {
"message": "Only display translation on Shift key pressed" "message": "Only display translation on specified modifier key pressed"
}, },
"specifiedKeyLabel": { "modifierKeyLabel": {
"message": "Specified Key" "message": "Modifier Key"
},
"specifyKeyLabel": {
"message": "Specify Key"
}, },
"shiftLabel": { "shiftLabel": {
"message": "Shift" "message": "Shift"

View file

@ -38,9 +38,9 @@ const handleMouseUp = async e => {
if (isInContentEditable()) return; if (isInContentEditable()) return;
} }
if (getSettings("ifOnlyTranslateWhenShiftPressed")) { if (getSettings("ifOnlyTranslateWhenModifierKeyPressed")) {
const spKey = getSettings("specifiedKey") const modifierKey = getSettings("modifierKey");
switch(spKey){ switch (modifierKey) {
case "shift": case "shift":
if (!e.shiftKey) return; if (!e.shiftKey) return;
break; break;
@ -54,7 +54,7 @@ const handleMouseUp = async e => {
if (!e.metaKey) return; if (!e.metaKey) return;
break; break;
default: default:
break; break;
} }
} }

View file

@ -88,20 +88,20 @@ export default [
] ]
}, },
{ {
title: "specifiedKeyLabel", title: "modifierKeyLabel",
captions: [], captions: [],
type: "none", type: "none",
childElements:[ childElements: [
{ {
id: "ifOnlyTranslateWhenShiftPressed", id: "ifOnlyTranslateWhenModifierKeyPressed",
title: "ifOnlyTranslateWhenShiftPressedLabel", title: "ifOnlyTranslateWhenModifierKeyPressedLabel",
captions: ["ifOnlyTranslateWhenShiftPressedCaptionLabel"], captions: ["ifOnlyTranslateWhenModifierKeyPressedCaptionLabel"],
type: "checkbox", type: "checkbox",
default: false default: false
}, },
{ {
id: "specifiedKey", id: "modifierKey",
title: "specifiedKeyLabel", title: "modifierKeyLabel",
captions: [], captions: [],
type: "select", type: "select",
default: "shift", default: "shift",