Skip to content

Commit e707100

Browse files
committed
feat: 🚸 增加设置了重复快捷键时的错误提示
1 parent 5e68ede commit e707100

7 files changed

Lines changed: 16 additions & 4 deletions

File tree

locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"jump_to_home": "Jump to the first page",
5454
"page_down": "Turn the page to the down",
5555
"page_up": "Turn the page to the up",
56+
"repeat_tip": "This hotkey has been bound to \"{{hotkey}}\"",
5657
"scroll_down": "Scroll down",
5758
"scroll_left": "Scroll left",
5859
"scroll_right": "Scroll right",

locales/hu.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"jump_to_home": "跳至首页",
5454
"page_down": "向下翻页",
5555
"page_up": "向上翻页",
56+
"repeat_tip": "Ez a gyorsbillentyű a \"{{hotkey}}\" gombhoz van rendelve",
5657
"scroll_down": "向下滚动",
5758
"scroll_left": "向左滚动",
5859
"scroll_right": "向右滚动",

locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"jump_to_home": "Перейти к первой странице",
5454
"page_down": "Перелистнуть страницу вниз",
5555
"page_up": "Перелистнуть страницу вверх",
56+
"repeat_tip": "Эта горячая клавиша была назначена на \"{{hotkey}}\"",
5657
"scroll_down": "Прокрутить вниз",
5758
"scroll_left": "Прокрутить влево",
5859
"scroll_right": "Прокрутите вправо",

locales/ta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"jump_to_home": "முகப்புப்பக்கத்திற்கு செல்லவும்",
5454
"page_down": "பக்கங்கள் கீழே",
5555
"page_up": "பக்கங்கள் மேலே",
56+
"repeat_tip": "இந்த விரைவு விசை \"{{hotkey}}\" க்கு பிணைக்கப்பட்டுள்ளது",
5657
"scroll_down": "கீழே உருட்டவும்",
5758
"scroll_left": "இடதுபுறத்தில் உருட்டவும்",
5859
"scroll_right": "வலதுபுறம் உருட்டவும்",

locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"jump_to_home": "跳至首页",
5454
"page_down": "向下翻页",
5555
"page_up": "向上翻页",
56+
"repeat_tip": "此快捷键已被绑定至「{{hotkey}}」",
5657
"scroll_down": "向下滚动",
5758
"scroll_left": "向左滚动",
5859
"scroll_right": "向右滚动",

src/components/Manga/actions/translation/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Accessor } from 'solid-js';
22

3+
import { toast } from 'components/Toast';
34
import { createRootMemo, range, singleThreaded, t } from 'helper';
45

56
import { setState, store } from '../../store';
@@ -8,8 +9,6 @@ import { cotransTranslation, cotransTranslators } from './cotrans';
89
import { createOptions, setMessage } from './helper';
910
import { selfhostedOptions, selfhostedTranslation } from './selfhosted';
1011

11-
declare const toast: typeof import('components/Toast/toast').toast | undefined;
12-
1312
/** 翻译指定图片 */
1413
export const translationImage = async (url: string) => {
1514
try {

src/components/Manga/components/SettingHotkeys.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import MdClose from '@material-design-icons/svg/round/close.svg';
55
import MdRefresh from '@material-design-icons/svg/round/refresh.svg';
66
import { For, Index, Show } from 'solid-js';
77

8+
import { toast } from 'components/Toast';
89
import {
910
createRootMemo,
1011
getKeyboardCode,
@@ -71,9 +72,16 @@ const KeyItem: Component<{
7172
return;
7273
}
7374

75+
unsafeWindow.toast = toast;
76+
7477
const newCode = getKeyboardCode(e);
75-
if (!Reflect.has(hotkeysMap(), newCode))
76-
setHotkeys(props.operateName, props.i, newCode);
78+
if (Reflect.has(hotkeysMap(), newCode))
79+
toast.error(
80+
t('hotkeys.repeat_tip', {
81+
hotkey: t(`hotkeys.${hotkeysMap()[newCode]}`),
82+
}),
83+
);
84+
else setHotkeys(props.operateName, props.i, newCode);
7785
};
7886

7987
return (

0 commit comments

Comments
 (0)