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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,12 +19,12 @@ import {
getTargetLanguageForBidirectional, getTargetLanguageForBidirectional,
isLanguageInPair isLanguageInPair
} from '@renderer/utils/translate' } 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 TextArea, { TextAreaRef } from 'antd/es/input/TextArea'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { useLiveQuery } from 'dexie-react-hooks' import { useLiveQuery } from 'dexie-react-hooks'
import { find, isEmpty, sortBy } from 'lodash' 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 { FC, useEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import styled from 'styled-components' import styled from 'styled-components'
@ -95,6 +95,7 @@ const TranslateSettings: FC<{
title={<div style={{ fontSize: 16 }}>{t('translate.settings.title')}</div>} title={<div style={{ fontSize: 16 }}>{t('translate.settings.title')}</div>}
open={visible} open={visible}
onCancel={onClose} onCancel={onClose}
centered={true}
footer={[ footer={[
<Button key="cancel" onClick={onClose}> <Button key="cancel" onClick={onClose}>
{t('common.cancel')} {t('common.cancel')}
@ -135,17 +136,28 @@ const TranslateSettings: FC<{
</div> </div>
</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>
<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%' }}> <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 && ( {isBidirectional && (
<Flex align="center" justify="space-between" gap={10}> <Flex align="center" justify="space-between" gap={10}>
<Select <Select
@ -185,16 +197,6 @@ const TranslateSettings: FC<{
)} )}
</Space> </Space>
</div> </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> </Flex>
</Modal> </Modal>
) )