diff --git a/apps/desktop/layer/renderer/src/modules/command/shortcuts/SettingShortcuts.tsx b/apps/desktop/layer/renderer/src/modules/command/shortcuts/SettingShortcuts.tsx index 970ba3f8a..0d50b316f 100644 --- a/apps/desktop/layer/renderer/src/modules/command/shortcuts/SettingShortcuts.tsx +++ b/apps/desktop/layer/renderer/src/modules/command/shortcuts/SettingShortcuts.tsx @@ -68,6 +68,7 @@ export const ShortcutSetting = () => { } const EditableCommandShortcutItem = memo(({ commandId }: { commandId: FollowCommandId }) => { + const { t } = useTranslation("shortcuts") const command = useCommand(commandId) const commandShortcuts = useCommandShortcuts() const [isEditing, setIsEditing] = useState(false) @@ -91,15 +92,12 @@ const EditableCommandShortcutItem = memo(({ commandId }: { commandId: FollowComm {isUserCustomize && ( -
+
- Custom + {t("settings.shortcuts.custom")}
- This shortcut is customized by you + {t("settings.shortcuts.custom_content")} )}
@@ -143,6 +141,7 @@ const ShortcutInputWrapper = memo( onEditingChange, onShortcutChange, }: ShortcutInputWrapperProps) => { + const { t } = useTranslation("shortcuts") const conflictResult = useIsShortcutConflict(shortcut, commandId as AllowCustomizeCommandId) const hasConflict = allowCustomize && conflictResult.hasConflict @@ -180,7 +179,7 @@ const ShortcutInputWrapper = memo( type="button" data-customized={isUserCustomize} className={cn( - "flex h-full cursor-text justify-end rounded-md border px-1 duration-200", + "relative flex h-full cursor-text justify-end rounded-md border px-1 duration-200", allowCustomize && "hover:!border-border hover:!bg-material-medium", getBorderColor(), getBackgroundColor(), @@ -210,11 +209,13 @@ const ShortcutInputWrapper = memo( {hasConflict && ( - +
-
Shortcut Conflict
-
- This shortcut conflicts with command: +
{t("settings.shortcuts.conflict")}
+
+ + {t("settings.shortcuts.conflict_command")} +

{conflictCommand?.label.title}

@@ -230,6 +231,7 @@ const KeyRecorder: FC<{ onChange: (keys: string[] | null) => void onBlur: () => void }> = ({ onChange, onBlur }) => { + const { t } = useTranslation("shortcuts") const { currentKeys } = useShortcutRecorder() const setGlobalScope = useReplaceGlobalFocusableScope() @@ -263,7 +265,7 @@ const KeyRecorder: FC<{
) : ( - Press keys to record + {t("settings.shortcuts.press_to_record")} )} @@ -280,13 +282,15 @@ const KeyRecorder: FC<{ }} > {currentKeys.length > 0 ? ( - - ) : ( + ) : ( + )} - {currentKeys.length > 0 ? "Undo" : "Reset"} + + {currentKeys.length > 0 ? t("settings.shortcuts.undo") : t("settings.shortcuts.reset")} +
) diff --git a/locales/shortcuts/en.json b/locales/shortcuts/en.json index 202074cd9..1808f96a8 100644 --- a/locales/shortcuts/en.json +++ b/locales/shortcuts/en.json @@ -69,5 +69,12 @@ "command.timeline.switch_to_previous.title": "Switch to Previous Timeline", "command.timeline.toggle_unread_only.description": "Enable/Disable the unread only mode in the timeline", "command.timeline.toggle_unread_only.title": "Toggle Unread Only", - "settings.shortcuts.description": "Customize the application's shortcuts. Below is a list of some commands that can be customized." + "settings.shortcuts.conflict": "Shortcut Conflict", + "settings.shortcuts.conflict_command": "This shortcut conflicts with command:", + "settings.shortcuts.custom": "Custom", + "settings.shortcuts.custom_content": "This shortcut is customized by you", + "settings.shortcuts.description": "Customize the application's shortcuts. Below is a list of some commands that can be customized.", + "settings.shortcuts.press_to_record": "Press keys to record", + "settings.shortcuts.reset": "Reset", + "settings.shortcuts.undo": "Undo" } diff --git a/locales/shortcuts/zh-CN.json b/locales/shortcuts/zh-CN.json index 96d77b727..5d6a760bc 100644 --- a/locales/shortcuts/zh-CN.json +++ b/locales/shortcuts/zh-CN.json @@ -69,5 +69,12 @@ "command.timeline.switch_to_previous.title": "切换到上一个时间线", "command.timeline.toggle_unread_only.description": "在时间线中启用或停用仅显示未读模式。", "command.timeline.toggle_unread_only.title": "切换仅显示未读", - "settings.shortcuts.description": "自定义应用的快捷键。以下是一些可以自定义的命令列表。" + "settings.shortcuts.conflict": "快捷键冲突", + "settings.shortcuts.conflict_command": "此快捷键与以下命令冲突:", + "settings.shortcuts.custom": "自定义", + "settings.shortcuts.custom_content": "此快捷键由您自定义", + "settings.shortcuts.description": "自定义应用的快捷键。以下是一些可以自定义的命令列表。", + "settings.shortcuts.press_to_record": "按下以记录", + "settings.shortcuts.reset": "重置", + "settings.shortcuts.undo": "撤销" }