feat: update translation settings to include bidirectional translation tips and remove deprecated options

This commit is contained in:
Pleasurecruise 2025-05-27 23:36:23 +08:00
parent d8d419f55a
commit ad44ab1a12
No known key found for this signature in database
GPG Key ID: E6385136096279B6
6 changed files with 28 additions and 42 deletions

View File

@ -1784,10 +1784,6 @@
"input.placeholder": "Enter text to translate",
"output.placeholder": "Translation",
"processing": "Translation in progress...",
"scroll_sync.disable": "Disable synced scroll",
"scroll_sync.enable": "Enable synced scroll",
"bidirectional.disable": "Disable bidirectional translation",
"bidirectional.enable": "Enable bidirectional translation",
"language.same": "Source and target languages are the same",
"language.not_pair": "Source language is different from the set language",
"settings": {
@ -1795,6 +1791,7 @@
"model": "Model Settings",
"model_desc": "Model used for translation service",
"bidirectional": "Bidirectional Translation Settings",
"bidirectional_tip": "When enabled, only bidirectional translation between source and target languages is supported",
"scroll_sync": "Scroll Sync Settings"
},
"title": "Translation",

View File

@ -1784,10 +1784,6 @@
"input.placeholder": "翻訳するテキストを入力",
"output.placeholder": "翻訳",
"processing": "翻訳中...",
"scroll_sync.disable": "關閉滾動同步",
"scroll_sync.enable": "開啟滾動同步",
"bidirectional.disable": "双方向翻訳を無効にする",
"bidirectional.enable": "双方向翻訳を有効にする",
"language.same": "ソース言語と目標言語が同じです",
"language.not_pair": "ソース言語が設定された言語と異なります",
"settings": {
@ -1795,6 +1791,7 @@
"model": "モデル設定",
"model_desc": "翻訳サービスで使用されるモデル",
"bidirectional": "双方向翻訳設定",
"bidirectional_tip": "有効にすると、ソース言語と目標言語間の双方向翻訳のみがサポートされます",
"scroll_sync": "スクロール同期設定"
},
"title": "翻訳",

View File

@ -1784,10 +1784,6 @@
"input.placeholder": "Введите текст для перевода",
"output.placeholder": "Перевод",
"processing": "Перевод в процессе...",
"scroll_sync.disable": "Отключить синхронизацию прокрутки",
"scroll_sync.enable": "Включить синхронизацию прокрутки",
"bidirectional.disable": "Отключить двунаправленный перевод",
"bidirectional.enable": "Включить двунаправленный перевод",
"language.same": "Исходный и целевой языки совпадают",
"language.not_pair": "Исходный язык отличается от настроенного",
"settings": {
@ -1795,6 +1791,7 @@
"model": "Настройки модели",
"model_desc": "Модель, используемая для службы перевода",
"bidirectional": "Настройки двунаправленного перевода",
"directional_tip": "После включения поддерживается только двунаправленный перевод между исходным и целевым языками",
"scroll_sync": "Настройки синхронизации прокрутки"
},
"title": "Перевод",

View File

@ -1787,10 +1787,6 @@
"input.placeholder": "输入文本进行翻译",
"output.placeholder": "翻译",
"processing": "翻译中...",
"scroll_sync.disable": "关闭滚动同步",
"scroll_sync.enable": "开启滚动同步",
"bidirectional.disable": "关闭双向翻译",
"bidirectional.enable": "开启双向翻译",
"language.same": "源语言和目标语言相同",
"language.not_pair": "源语言与设置的语言不同",
"settings": {
@ -1798,6 +1794,7 @@
"model": "模型设置",
"model_desc": "翻译服务使用的模型",
"bidirectional": "双向翻译设置",
"bidirectional_tip": "开启后,仅支持在源语言和目标语言之间进行双向翻译",
"scroll_sync": "滚动同步设置"
},
"title": "翻译",

View File

@ -598,12 +598,11 @@
"citations": "引用內容",
"copied": "已複製!",
"copy.failed": "複製失敗",
"copy.success": "已複製!",
"copy.success": "複製成功",
"delete.confirm.title": "刪除確認",
"delete.confirm.content": "確認刪除選中的 {{count}} 條訊息嗎?",
"delete.failed": "刪除失敗",
"delete.success": "刪除成功",
"copy.success": "複製成功",
"empty_url": "無法下載圖片,可能是提示詞包含敏感內容或違禁詞彙",
"error.chunk_overlap_too_large": "分段重疊不能大於分段大小",
"error.dimension_too_large": "內容尺寸過大",
@ -1785,10 +1784,6 @@
"input.placeholder": "輸入文字進行翻譯",
"output.placeholder": "翻譯",
"processing": "翻譯中...",
"scroll_sync.disable": "關閉滾動同步",
"scroll_sync.enable": "開啟滾動同步",
"bidirectional.disable": "關閉雙向翻譯",
"bidirectional.enable": "開啟雙向翻譯",
"language.same": "源語言和目標語言相同",
"language.not_pair": "源語言與設定的語言不同",
"settings": {
@ -1796,6 +1791,7 @@
"model": "模型設定",
"model_desc": "翻譯服務使用的模型",
"bidirectional": "雙向翻譯設定",
"bidirectional_tip": "開啟後,僅支援在源語言和目標語言之間進行雙向翻譯",
"scroll_sync": "滾動同步設定"
},
"title": "翻譯",

View File

@ -19,12 +19,12 @@ import {
getTargetLanguageForBidirectional,
isLanguageInPair
} from '@renderer/utils/translate'
import { Button, Divider, Empty, Flex, Modal, Popconfirm, Select, Space, Switch, Tooltip } from 'antd'
import { Button, Empty, Flex, Modal, Popconfirm, Select, Space, Switch, Tooltip } from 'antd'
import TextArea, { TextAreaRef } from 'antd/es/input/TextArea'
import dayjs from 'dayjs'
import { useLiveQuery } from 'dexie-react-hooks'
import { find, isEmpty, sortBy } from 'lodash'
import { Settings2, TriangleAlert } from 'lucide-react'
import { HelpCircle, Settings2, TriangleAlert } from 'lucide-react'
import { FC, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
@ -95,6 +95,7 @@ const TranslateSettings: FC<{
title={<div style={{ fontSize: 16 }}>{t('translate.settings.title')}</div>}
open={visible}
onCancel={onClose}
centered={true}
footer={[
<Button key="cancel" onClick={onClose}>
{t('common.cancel')}
@ -135,17 +136,28 @@ const TranslateSettings: FC<{
</div>
</div>
<Divider style={{ margin: '8px 0' }} />
<div>
<Flex align="center" justify="space-between">
<div style={{ fontWeight: 500 }}>{t('translate.settings.scroll_sync')}</div>
<Switch checked={isScrollSyncEnabled} onChange={setIsScrollSyncEnabled} />
</Flex>
</div>
<div>
<div style={{ marginBottom: 8, fontWeight: 500 }}>{t('translate.settings.bidirectional')}</div>
<Flex align="center" justify="space-between" style={{ marginBottom: 8 }}>
<div style={{ fontWeight: 500 }}>
<HStack alignItems="center" gap={5}>
{t('translate.settings.bidirectional')}
<Tooltip title={t('translate.settings.bidirectional_tip')}>
<span style={{ display: 'flex', alignItems: 'center' }}>
<HelpCircle size={14} style={{ color: 'var(--color-text-3)' }} />
</span>
</Tooltip>
</HStack>
</div>
<Switch checked={isBidirectional} onChange={setIsBidirectional} />
</Flex>
<Space direction="vertical" style={{ width: '100%' }}>
<Flex align="center" justify="space-between">
<span>
{isBidirectional ? t('translate.bidirectional.disable') : t('translate.bidirectional.enable')}
</span>
<Switch checked={isBidirectional} onChange={setIsBidirectional} />
</Flex>
{isBidirectional && (
<Flex align="center" justify="space-between" gap={10}>
<Select
@ -185,16 +197,6 @@ const TranslateSettings: FC<{
)}
</Space>
</div>
<Divider style={{ margin: '8px 0' }} />
<div>
<div style={{ marginBottom: 8, fontWeight: 500 }}>{t('translate.settings.scroll_sync')}</div>
<Flex align="center" justify="space-between">
<span>{isScrollSyncEnabled ? t('translate.scroll_sync.disable') : t('translate.scroll_sync.enable')}</span>
<Switch checked={isScrollSyncEnabled} onChange={setIsScrollSyncEnabled} />
</Flex>
</div>
</Flex>
</Modal>
)