From 73209a4f0a7e9ab14eb6055de9c9a762f8eae253 Mon Sep 17 00:00:00 2001 From: 1600822305 <1600822305@qq.com> Date: Thu, 10 Apr 2025 16:25:48 +0800 Subject: [PATCH] 1 --- src/renderer/src/i18n/locales/en-us.json | 20 +++- src/renderer/src/i18n/locales/ja-jp.json | 59 ++++++++-- src/renderer/src/i18n/locales/ru-ru.json | 103 ++++++++++++++++-- src/renderer/src/i18n/locales/zh-tw.json | 103 ++++++++++++++++-- .../settings/TTSSettings/ASRSettings.tsx | 4 +- src/renderer/src/types/electron.d.ts | 7 +- 6 files changed, 255 insertions(+), 41 deletions(-) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 2103c98429..c2f6aeb6c8 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -1378,7 +1378,14 @@ "max_text_length": "Maximum text length", "test": "Test Speech", "help": "Text-to-speech functionality supports converting text to natural-sounding speech.", - "learn_more": "Learn more" + "learn_more": "Learn more", + "tab_title": "[to be translated]:语音合成", + "error": { + "not_enabled": "[to be translated]:语音合成功能未启用", + "no_api_key": "[to be translated]:未设置API密钥", + "no_edge_voice": "[to be translated]:未选择浏览器 TTS音色", + "browser_not_support": "[to be translated]:浏览器不支持语音合成" + } }, "asr": { "title": "Speech Recognition", @@ -1423,8 +1430,15 @@ "error": { "not_enabled": "Speech recognition is not enabled", "start_failed": "Failed to start recording", - "transcribe_failed": "Failed to transcribe speech" + "transcribe_failed": "Failed to transcribe speech", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音识别" } + }, + "voice": { + "title": "[to be translated]:语音功能", + "help": "[to be translated]:语音功能包括文本转语音(TTS)和语音识别(ASR)。", + "learn_more": "[to be translated]:了解更多" } }, "translate": { @@ -1467,4 +1481,4 @@ "visualization": "Visualization" } } -} +} \ No newline at end of file diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index 17488f64b5..d4af289fe5 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -103,13 +103,13 @@ "default.description": "こんにちは、私はデフォルトのアシスタントです。すぐにチャットを始められます。", "default.name": "デフォルトアシスタント", "default.topic.name": "デフォルトトピック", - "tts": { - "play": "音声を再生", - "stop": "再生を停止", - "speak": "音声を再生", - "stop_global": "すべての音声再生を停止", - "stopped": "音声再生を停止しました" - }, + "tts": { + "play": "音声を再生", + "stop": "再生を停止", + "speak": "音声を再生", + "stop_global": "すべての音声再生を停止", + "stopped": "音声再生を停止しました" + }, "history": { "assistant_node": "アシスタント", "click_to_navigate": "メッセージに移動", @@ -1352,12 +1352,40 @@ "service_type.edge": "ブラウザ TTS", "test": "テスト", "error": { - "failed": "音声合成に失敗しました", "not_enabled": "音声合成が有効になっていません", - "no_edge_voice": "ブラウザ TTSの音声が選択されていません" + "no_edge_voice": "ブラウザ TTSの音声が選択されていません", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音合成" }, "help": "OpenAIのTTS APIを使用するには、APIキーが必要です。ブラウザ TTSはブラウザの機能を使用するため、APIキーは不要です。", - "learn_more": "詳細はこちら" + "learn_more": "詳細はこちら", + "tab_title": "[to be translated]:语音合成", + "service_type.refresh": "[to be translated]:刷新TTS服务类型设置", + "service_type.refreshed": "[to be translated]:已刷新TTS服务类型设置", + "api_key": "[to be translated]:API密钥", + "api_key.placeholder": "[to be translated]:请输入OpenAI API密钥", + "api_url": "[to be translated]:API地址", + "api_url.placeholder": "[to be translated]:例如:https://api.openai.com/v1/audio/speech", + "edge_voice": "[to be translated]:浏览器 TTS音色", + "edge_voice.loading": "[to be translated]:加载中...", + "edge_voice.refresh": "[to be translated]:刷新可用音色列表", + "edge_voice.not_found": "[to be translated]:未找到匹配的音色", + "voice": "[to be translated]:音色", + "voice.placeholder": "[to be translated]:请选择音色", + "voice_input_placeholder": "[to be translated]:输入音色", + "voice_add": "[to be translated]:添加", + "voice_empty": "[to be translated]:暂无自定义音色,请在下方添加", + "model": "[to be translated]:模型", + "model.placeholder": "[to be translated]:请选择模型", + "model_input_placeholder": "[to be translated]:输入模型", + "model_add": "[to be translated]:添加", + "model_empty": "[to be translated]:暂无自定义模型,请在下方添加", + "filter_options": "[to be translated]:过滤选项", + "filter.thinking_process": "[to be translated]:过滤思考过程", + "filter.markdown": "[to be translated]:过滤Markdown标记", + "filter.code_blocks": "[to be translated]:过滤代码块", + "filter.html_tags": "[to be translated]:过滤HTML标签", + "max_text_length": "[to be translated]:最大文本长度" }, "asr": { "title": "音声認識", @@ -1402,8 +1430,15 @@ "error": { "not_enabled": "音声認識が有効になっていません", "start_failed": "録音の開始に失敗しました", - "transcribe_failed": "音声の文字起こしに失敗しました" + "transcribe_failed": "音声の文字起こしに失敗しました", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音识别" } + }, + "voice": { + "title": "[to be translated]:语音功能", + "help": "[to be translated]:语音功能包括文本转语音(TTS)和语音识别(ASR)。", + "learn_more": "[to be translated]:了解更多" } }, "translate": { @@ -1446,4 +1481,4 @@ "visualization": "可視化" } } -} +} \ No newline at end of file diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index ee67104483..4a9e285e10 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -103,13 +103,13 @@ "default.description": "Привет, я Ассистент по умолчанию. Вы можете начать общаться со мной прямо сейчас", "default.name": "Ассистент по умолчанию", "default.topic.name": "Топик по умолчанию", - "tts": { - "play": "Воспроизвести речь", - "stop": "Остановить воспроизведение", - "speak": "Воспроизвести речь", - "stop_global": "Остановить все воспроизведение речи", - "stopped": "Воспроизведение речи остановлено" - }, + "tts": { + "play": "Воспроизвести речь", + "stop": "Остановить воспроизведение", + "speak": "Воспроизвести речь", + "stop_global": "Остановить все воспроизведение речи", + "stopped": "Воспроизведение речи остановлено" + }, "history": { "assistant_node": "Ассистент", "click_to_navigate": "Перейти к сообщению", @@ -1352,12 +1352,93 @@ "service_type.edge": "Edge TTS", "test": "Тест", "error": { - "failed": "Не удалось преобразовать текст в речь", "not_enabled": "Преобразование текста в речь не включено", - "no_edge_voice": "Голос Edge TTS не выбран" + "no_edge_voice": "Голос Edge TTS не выбран", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音合成" }, "help": "Для использования API TTS OpenAI требуется ключ API. Edge TTS использует функции браузера и не требует ключа API.", - "learn_more": "Узнать больше" + "learn_more": "Узнать больше", + "tab_title": "[to be translated]:语音合成", + "service_type.refresh": "[to be translated]:刷新TTS服务类型设置", + "service_type.refreshed": "[to be translated]:已刷新TTS服务类型设置", + "api_key": "[to be translated]:API密钥", + "api_key.placeholder": "[to be translated]:请输入OpenAI API密钥", + "api_url": "[to be translated]:API地址", + "api_url.placeholder": "[to be translated]:例如:https://api.openai.com/v1/audio/speech", + "edge_voice": "[to be translated]:浏览器 TTS音色", + "edge_voice.loading": "[to be translated]:加载中...", + "edge_voice.refresh": "[to be translated]:刷新可用音色列表", + "edge_voice.not_found": "[to be translated]:未找到匹配的音色", + "voice": "[to be translated]:音色", + "voice.placeholder": "[to be translated]:请选择音色", + "voice_input_placeholder": "[to be translated]:输入音色", + "voice_add": "[to be translated]:添加", + "voice_empty": "[to be translated]:暂无自定义音色,请在下方添加", + "model": "[to be translated]:模型", + "model.placeholder": "[to be translated]:请选择模型", + "model_input_placeholder": "[to be translated]:输入模型", + "model_add": "[to be translated]:添加", + "model_empty": "[to be translated]:暂无自定义模型,请在下方添加", + "filter_options": "[to be translated]:过滤选项", + "filter.thinking_process": "[to be translated]:过滤思考过程", + "filter.markdown": "[to be translated]:过滤Markdown标记", + "filter.code_blocks": "[to be translated]:过滤代码块", + "filter.html_tags": "[to be translated]:过滤HTML标签", + "max_text_length": "[to be translated]:最大文本长度" + }, + "voice": { + "title": "[to be translated]:语音功能", + "help": "[to be translated]:语音功能包括文本转语音(TTS)和语音识别(ASR)。", + "learn_more": "[to be translated]:了解更多" + }, + "asr": { + "title": "[to be translated]:语音识别", + "tab_title": "[to be translated]:语音识别", + "enable": "[to be translated]:启用语音识别", + "enable.help": "[to be translated]:启用后可以将语音转换为文本", + "service_type": "[to be translated]:服务类型", + "service_type.browser": "[to be translated]:浏览器", + "service_type.local": "[to be translated]:本地服务器", + "api_key": "[to be translated]:API密钥", + "api_key.placeholder": "[to be translated]:请输入OpenAI API密钥", + "api_url": "[to be translated]:API地址", + "api_url.placeholder": "[to be translated]:例如:https://api.openai.com/v1/audio/transcriptions", + "model": "[to be translated]:模型", + "browser.info": "[to be translated]:使用浏览器内置的语音识别功能,无需额外设置", + "local.info": "[to be translated]:使用本地服务器和浏览器进行语音识别,需要先启动服务器并打开浏览器页面", + "local.browser_tip": "[to be translated]:请在浏览器中打开此页面,并保持浏览器窗口打开", + "local.test_connection": "[to be translated]:测试连接", + "local.connection_success": "[to be translated]:连接成功", + "local.connection_failed": "[to be translated]:连接失败,请确保服务器已启动", + "server.start": "[to be translated]:启动服务器", + "server.stop": "[to be translated]:停止服务器", + "server.starting": "[to be translated]:正在启动服务器...", + "server.started": "[to be translated]:服务器已启动", + "server.stopping": "[to be translated]:正在停止服务器...", + "server.stopped": "[to be translated]:服务器已停止", + "server.already_running": "[to be translated]:服务器已经在运行中", + "server.not_running": "[to be translated]:服务器未运行", + "server.start_failed": "[to be translated]:启动服务器失败", + "server.stop_failed": "[to be translated]:停止服务器失败", + "open_browser": "[to be translated]:打开浏览器页面", + "test": "[to be translated]:测试语音识别", + "test_info": "[to be translated]:请在输入框中使用语音识别按钮进行测试", + "start": "[to be translated]:开始录音", + "stop": "[to be translated]:停止录音", + "preparing": "[to be translated]:准备中", + "recording": "[to be translated]:正在录音...", + "processing": "[to be translated]:正在处理语音...", + "success": "[to be translated]:语音识别成功", + "completed": "[to be translated]:语音识别完成", + "canceled": "[to be translated]:已取消录音", + "error": { + "not_enabled": "[to be translated]:语音识别功能未启用", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音识别", + "start_failed": "[to be translated]:开始录音失败", + "transcribe_failed": "[to be translated]:语音识别失败" + } } }, "translate": { @@ -1400,4 +1481,4 @@ "visualization": "Визуализация" } } -} +} \ No newline at end of file diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index bfc75a11ab..047a9a3ba9 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -103,13 +103,13 @@ "default.description": "你好,我是預設助手。你可以立即開始與我聊天。", "default.name": "預設助手", "default.topic.name": "預設話題", - "tts": { - "play": "播放語音", - "stop": "停止播放", - "speak": "播放語音", - "stop_global": "停止所有語音播放", - "stopped": "已停止語音播放" - }, + "tts": { + "play": "播放語音", + "stop": "停止播放", + "speak": "播放語音", + "stop_global": "停止所有語音播放", + "stopped": "已停止語音播放" + }, "history": { "assistant_node": "助手", "click_to_navigate": "點擊跳轉到對應訊息", @@ -1352,12 +1352,93 @@ "service_type.edge": "Edge TTS", "test": "測試", "error": { - "failed": "語音合成失敗", "not_enabled": "語音合成未啟用", - "no_edge_voice": "未選擇Edge TTS音色" + "no_edge_voice": "未選擇Edge TTS音色", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音合成" }, "help": "使用OpenAI的TTS API需要API金鑰。Edge TTS使用瀏覽器功能,不需要API金鑰。", - "learn_more": "了解更多" + "learn_more": "了解更多", + "tab_title": "[to be translated]:语音合成", + "service_type.refresh": "[to be translated]:刷新TTS服务类型设置", + "service_type.refreshed": "[to be translated]:已刷新TTS服务类型设置", + "api_key": "[to be translated]:API密钥", + "api_key.placeholder": "[to be translated]:请输入OpenAI API密钥", + "api_url": "[to be translated]:API地址", + "api_url.placeholder": "[to be translated]:例如:https://api.openai.com/v1/audio/speech", + "edge_voice": "[to be translated]:浏览器 TTS音色", + "edge_voice.loading": "[to be translated]:加载中...", + "edge_voice.refresh": "[to be translated]:刷新可用音色列表", + "edge_voice.not_found": "[to be translated]:未找到匹配的音色", + "voice": "[to be translated]:音色", + "voice.placeholder": "[to be translated]:请选择音色", + "voice_input_placeholder": "[to be translated]:输入音色", + "voice_add": "[to be translated]:添加", + "voice_empty": "[to be translated]:暂无自定义音色,请在下方添加", + "model": "[to be translated]:模型", + "model.placeholder": "[to be translated]:请选择模型", + "model_input_placeholder": "[to be translated]:输入模型", + "model_add": "[to be translated]:添加", + "model_empty": "[to be translated]:暂无自定义模型,请在下方添加", + "filter_options": "[to be translated]:过滤选项", + "filter.thinking_process": "[to be translated]:过滤思考过程", + "filter.markdown": "[to be translated]:过滤Markdown标记", + "filter.code_blocks": "[to be translated]:过滤代码块", + "filter.html_tags": "[to be translated]:过滤HTML标签", + "max_text_length": "[to be translated]:最大文本长度" + }, + "voice": { + "title": "[to be translated]:语音功能", + "help": "[to be translated]:语音功能包括文本转语音(TTS)和语音识别(ASR)。", + "learn_more": "[to be translated]:了解更多" + }, + "asr": { + "title": "[to be translated]:语音识别", + "tab_title": "[to be translated]:语音识别", + "enable": "[to be translated]:启用语音识别", + "enable.help": "[to be translated]:启用后可以将语音转换为文本", + "service_type": "[to be translated]:服务类型", + "service_type.browser": "[to be translated]:浏览器", + "service_type.local": "[to be translated]:本地服务器", + "api_key": "[to be translated]:API密钥", + "api_key.placeholder": "[to be translated]:请输入OpenAI API密钥", + "api_url": "[to be translated]:API地址", + "api_url.placeholder": "[to be translated]:例如:https://api.openai.com/v1/audio/transcriptions", + "model": "[to be translated]:模型", + "browser.info": "[to be translated]:使用浏览器内置的语音识别功能,无需额外设置", + "local.info": "[to be translated]:使用本地服务器和浏览器进行语音识别,需要先启动服务器并打开浏览器页面", + "local.browser_tip": "[to be translated]:请在浏览器中打开此页面,并保持浏览器窗口打开", + "local.test_connection": "[to be translated]:测试连接", + "local.connection_success": "[to be translated]:连接成功", + "local.connection_failed": "[to be translated]:连接失败,请确保服务器已启动", + "server.start": "[to be translated]:启动服务器", + "server.stop": "[to be translated]:停止服务器", + "server.starting": "[to be translated]:正在启动服务器...", + "server.started": "[to be translated]:服务器已启动", + "server.stopping": "[to be translated]:正在停止服务器...", + "server.stopped": "[to be translated]:服务器已停止", + "server.already_running": "[to be translated]:服务器已经在运行中", + "server.not_running": "[to be translated]:服务器未运行", + "server.start_failed": "[to be translated]:启动服务器失败", + "server.stop_failed": "[to be translated]:停止服务器失败", + "open_browser": "[to be translated]:打开浏览器页面", + "test": "[to be translated]:测试语音识别", + "test_info": "[to be translated]:请在输入框中使用语音识别按钮进行测试", + "start": "[to be translated]:开始录音", + "stop": "[to be translated]:停止录音", + "preparing": "[to be translated]:准备中", + "recording": "[to be translated]:正在录音...", + "processing": "[to be translated]:正在处理语音...", + "success": "[to be translated]:语音识别成功", + "completed": "[to be translated]:语音识别完成", + "canceled": "[to be translated]:已取消录音", + "error": { + "not_enabled": "[to be translated]:语音识别功能未启用", + "no_api_key": "[to be translated]:未设置API密钥", + "browser_not_support": "[to be translated]:浏览器不支持语音识别", + "start_failed": "[to be translated]:开始录音失败", + "transcribe_failed": "[to be translated]:语音识别失败" + } } }, "translate": { @@ -1400,4 +1481,4 @@ "visualization": "視覺化" } } -} +} \ No newline at end of file diff --git a/src/renderer/src/pages/settings/TTSSettings/ASRSettings.tsx b/src/renderer/src/pages/settings/TTSSettings/ASRSettings.tsx index 3c1c122b3a..dc44dbb3e8 100644 --- a/src/renderer/src/pages/settings/TTSSettings/ASRSettings.tsx +++ b/src/renderer/src/pages/settings/TTSSettings/ASRSettings.tsx @@ -105,7 +105,7 @@ const ASRSettings: FC = () => { {/* 浏览器ASR设置 */} {asrServiceType === 'browser' && ( - + {t('settings.asr.browser.info')} )} @@ -113,7 +113,7 @@ const ASRSettings: FC = () => { {asrServiceType === 'local' && ( <> - + {t('settings.asr.local.info')} diff --git a/src/renderer/src/types/electron.d.ts b/src/renderer/src/types/electron.d.ts index a916179e7a..73db73aba2 100644 --- a/src/renderer/src/types/electron.d.ts +++ b/src/renderer/src/types/electron.d.ts @@ -6,8 +6,8 @@ interface ObsidianAPI { interface IpcRendererAPI { invoke: (channel: string, ...args: any[]) => Promise - on: (channel: string, listener: (...args: any[]) => void) => void - once: (channel: string, listener: (...args: any[]) => void) => void + on: (channel: string, listener: (...args: any[]) => void) => () => void + once: (channel: string, listener: (...args: any[]) => void) => () => void removeListener: (channel: string, listener: (...args: any[]) => void) => void removeAllListeners: (channel: string) => void send: (channel: string, ...args: any[]) => void @@ -16,6 +16,9 @@ interface IpcRendererAPI { interface ElectronAPI { ipcRenderer: IpcRendererAPI + process: { + platform: string + } } interface Window {