mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
parent
5db7be061c
commit
ec0836c471
@ -22,9 +22,12 @@ const TranslateButton: FC<Props> = ({ text, onTranslated, disabled, style, isLoa
|
||||
const { t } = useTranslation()
|
||||
const { translateModel } = useDefaultModel()
|
||||
const [isTranslating, setIsTranslating] = useState(false)
|
||||
const { targetLanguage } = useSettings()
|
||||
const { targetLanguage, showTranslateConfirm } = useSettings()
|
||||
|
||||
const translateConfirm = () => {
|
||||
if (!showTranslateConfirm) {
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
return window?.modal?.confirm({
|
||||
title: t('translate.confirm.title'),
|
||||
content: t('translate.confirm.content'),
|
||||
|
||||
@ -1051,6 +1051,7 @@
|
||||
"general.user_name.placeholder": "Enter your name",
|
||||
"general.view_webdav_settings": "View WebDAV settings",
|
||||
"input.auto_translate_with_space": "Quickly translate with 3 spaces",
|
||||
"input.show_translate_confirm": "Show translation confirmation dialog",
|
||||
"input.target_language": "Target language",
|
||||
"input.target_language.chinese": "Simplified Chinese",
|
||||
"input.target_language.chinese-traditional": "Traditional Chinese",
|
||||
|
||||
@ -1051,6 +1051,7 @@
|
||||
"general.user_name.placeholder": "请输入用户名",
|
||||
"general.view_webdav_settings": "查看 WebDAV 设置",
|
||||
"input.auto_translate_with_space": "快速敲击3次空格翻译",
|
||||
"input.show_translate_confirm": "显示翻译确认对话框",
|
||||
"input.target_language": "目标语言",
|
||||
"input.target_language.chinese": "简体中文",
|
||||
"input.target_language.chinese-traditional": "繁体中文",
|
||||
|
||||
@ -1050,6 +1050,7 @@
|
||||
"general.user_name.placeholder": "輸入您的名稱",
|
||||
"general.view_webdav_settings": "檢視 WebDAV 設定",
|
||||
"input.auto_translate_with_space": "快速敲擊 3 次空格翻譯",
|
||||
"input.show_translate_confirm": "顯示翻譯確認對話框",
|
||||
"input.target_language": "目標語言",
|
||||
"input.target_language.chinese": "簡體中文",
|
||||
"input.target_language.chinese-traditional": "繁體中文",
|
||||
|
||||
@ -40,7 +40,8 @@ import {
|
||||
setRenderInputMessageAsMarkdown,
|
||||
setShowInputEstimatedTokens,
|
||||
setShowMessageDivider,
|
||||
setThoughtAutoCollapse
|
||||
setThoughtAutoCollapse,
|
||||
setShowTranslateConfirm
|
||||
} from '@renderer/store/settings'
|
||||
import {
|
||||
Assistant,
|
||||
@ -100,7 +101,8 @@ const SettingsTab: FC<Props> = (props) => {
|
||||
thoughtAutoCollapse,
|
||||
messageNavigation,
|
||||
enableQuickPanelTriggers,
|
||||
enableBackspaceDeleteModel
|
||||
enableBackspaceDeleteModel,
|
||||
showTranslateConfirm
|
||||
} = useSettings()
|
||||
|
||||
const onUpdateAssistantSettings = (settings: Partial<AssistantSettings>) => {
|
||||
@ -609,6 +611,15 @@ const SettingsTab: FC<Props> = (props) => {
|
||||
<SettingDivider />
|
||||
</>
|
||||
)}
|
||||
<SettingRow>
|
||||
<SettingRowTitleSmall>{t('settings.input.show_translate_confirm')}</SettingRowTitleSmall>
|
||||
<Switch
|
||||
size="small"
|
||||
checked={showTranslateConfirm}
|
||||
onChange={(checked) => dispatch(setShowTranslateConfirm(checked))}
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingDivider />
|
||||
<SettingRow>
|
||||
<SettingRowTitleSmall>{t('settings.messages.input.enable_quick_triggers')}</SettingRowTitleSmall>
|
||||
<Switch
|
||||
|
||||
@ -75,6 +75,7 @@ export interface SettingsState {
|
||||
webdavMaxBackups: number
|
||||
translateModelPrompt: string
|
||||
autoTranslateWithSpace: boolean
|
||||
showTranslateConfirm: boolean
|
||||
enableTopicNaming: boolean
|
||||
customCss: string
|
||||
topicNamingPrompt: string
|
||||
@ -182,6 +183,7 @@ export const initialState: SettingsState = {
|
||||
webdavMaxBackups: 0,
|
||||
translateModelPrompt: TRANSLATE_PROMPT,
|
||||
autoTranslateWithSpace: false,
|
||||
showTranslateConfirm: true,
|
||||
enableTopicNaming: true,
|
||||
customCss: '',
|
||||
topicNamingPrompt: '',
|
||||
@ -388,6 +390,9 @@ const settingsSlice = createSlice({
|
||||
setAutoTranslateWithSpace: (state, action: PayloadAction<boolean>) => {
|
||||
state.autoTranslateWithSpace = action.payload
|
||||
},
|
||||
setShowTranslateConfirm: (state, action: PayloadAction<boolean>) => {
|
||||
state.showTranslateConfirm = action.payload
|
||||
},
|
||||
setEnableTopicNaming: (state, action: PayloadAction<boolean>) => {
|
||||
state.enableTopicNaming = action.payload
|
||||
},
|
||||
@ -554,6 +559,7 @@ export const {
|
||||
setCodeStyle,
|
||||
setTranslateModelPrompt,
|
||||
setAutoTranslateWithSpace,
|
||||
setShowTranslateConfirm,
|
||||
setEnableTopicNaming,
|
||||
setPasteLongTextThreshold,
|
||||
setCustomCss,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user