From 0ab734d1a5949c774bc8d350d74feaa3b3b2e91f Mon Sep 17 00:00:00 2001 From: Gabe Date: Mon, 13 Oct 2025 00:54:02 +0800 Subject: [PATCH] fix: update readme --- README.en.md | 109 ++++++++++------------------------ README.md | 94 +++++++---------------------- custom-api.md | 2 + src/config/i18n.js | 43 +++++++++----- src/libs/translator.js | 6 +- src/views/Options/Apis.js | 2 + src/views/Options/Setting.js | 3 + src/views/Options/Subtitle.js | 2 + 8 files changed, 94 insertions(+), 167 deletions(-) diff --git a/README.en.md b/README.en.md index c1dd8b0..3ed6d6c 100644 --- a/README.en.md +++ b/README.en.md @@ -9,6 +9,7 @@ After a period of intermittent development, the planned features for the new ver * The automatic text detection mode enables complete translation for the vast majority of websites without the need to write specific rules. * The previous manual rule mode has been retained for meticulous optimization on specific websites. * Supports rich text translation, preserving links and other text styles from the original content as much as possible. + * Optimize the display effect of showing only translated text (hiding original text). * **API Refactoring:** * Supports adding and deleting an arbitrary number of APIs. @@ -16,6 +17,7 @@ After a period of intermittent development, the planned features for the new ver * Supports the built-in Chrome AI translation API, enabling AI-powered translation without an internet connection. * Supports AI contextual conversation memory to enhance translation quality. * All APIs support advanced features such as hooks and custom parameters. + * Added support for Azure AI translation interface. * **Optimized YouTube Subtitle Support:** * Supports translating video subtitles with any translation service and displaying them bilingually. @@ -52,24 +54,36 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht - [x] Thunderbird - [x] Supports multiple translation services - [x] Google/Microsoft - - [x] Baidu/Tencent/Volcengine - - [x] OpenAI/Gemini/Claude/Ollama/DeepSeek/CloudflareAI + - [x] Tencent/Volcengine + - [x] OpenAI/Gemini/Claude/Ollama/DeepSeek/OpenRouter - [x] DeepL/DeepLX/NiuTrans + - [x] BuiltinAI/AzureAI/CloudflareAI - [x] Custom translation interface - [x] Covers common translation scenarios - [x] Web bilingual translation - [x] Input box translation - [x] Seletction translation + - [x] Open the translation box on any page - [x] Favorite Words - [x] Mouseover translation - [x] YouTube subtitle translation + - [x] Support for various translation effects + - [x] Customizable text recognition and full-text translation + - [x] Customizable translation styles + - [x] Support for rich text translation and display + - [x] Support for displaying only the translated text (hiding the original text) + - [x] Advanced translation API features + - [x] Aggregate and send translated texts in batches + - [x] AI contextual conversation memory + - [x] Customizable AI terminology dictionary + - [x] AI-powered subtitle segmentation and translation + - [x] Customizable hooks and parameters - [x] Cross-client data synchronization - [x] KISS-Worker(cloudflare/docker) - [x] WebDAV - [x] Custom translation rules - [x] Rule subscription/rule sharing - [x] Customized terminology -- [x] Custom translation style - [x] Custom shortcut keys - `Alt+Q` Toggle Translation - `Alt+C` Toggle Styles @@ -82,7 +96,7 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht > Note: For the following reasons, it is recommended to use browser extensions first > -> - Browser extensions have more complete functions (local language recognition, context menu, etc.) +> - Browser extensions have more complete functions (subtitle translation, local language recognition, context menu, etc.) > - Grease Monkey script will encounter more usage problems (cross domain issues, script conflicts, etc.) - [x] Browser extension @@ -91,9 +105,9 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht - [x] Orion (iOS) - [x] Edge [Installation address](https://microsoftedge.microsoft.com/addons/detail/%E7%AE%80%E7%BA%A6%E7%BF%BB%E8%AF%91/jemckldkclkinpjighnoilpbldbdmmlh?hl=zh-CN) - [x] Firefox [Installation address](https://addons.mozilla.org/zh-CN/firefox/addon/kiss-translator/) - - [x] Safari - - [x] Safari (Mac) - - [x] Safari (iOS) + - [ ] Safari + - [ ] Safari (Mac) + - [ ] Safari (iOS) - [x] Thunderbird [Download address](https://github.com/fishjar/kiss-translator/releases) - [x] GreaseMonkey Script - [x] Chrome/Edge/Firefox ([Tampermonkey](https://www.tampermonkey.net/)/[Violentmonkey](https://violentmonkey.github.io/)) [Installation link](https://fishjar.github.io/kiss-translator/kiss-translator.user.js) @@ -109,9 +123,6 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht - Community subscription rules: [https://github.com/fishjar/kiss-rules](https://github.com/fishjar/kiss-rules) - Provides the latest and most complete list of subscription rules maintained by the community. - Help with rules-related issues. -- Translation interface agent: [https://github.com/fishjar/kiss-proxy](https://github.com/fishjar/kiss-proxy) - - If you encounter network problems when accessing a certain translation interface, this proxy service may help you. - - Deploy and manage by yourself. ## Frequently Asked Questions @@ -119,9 +130,8 @@ A simple, open source [bilingual translation extension & Greasemonkey script](ht You can achieve this through `Rules Setting` with the following methods: -- Personal Rules: RULES-> Global Rule -> Translate Switch -> Disaabled -- Subscription Rules: SUBSCRIBE -> Select the third option `kiss-rules-off.json` -- Override Subscription Rules: OVERWRITE -> Translate Switch -> Disaabled +- Global Rule -> Translate Switch -> Disaabled +- Subscription Rules: Select the third option `kiss-rules-off_v2.json` - Add a Personal Rule for a Specific Website: Translate Switch -> Disaabled ### How to Set Keyboard Shortcuts @@ -131,35 +141,16 @@ Set this in the extension management page, for example: - chrome [chrome://extensions/shortcuts](chrome://extensions/shortcuts) - firefox [about:addons](about:addons) -### How to Turn Off Selection Translation - -Set this in the `Rules Setting`: RULES -> Global Rule -> If translate selected -> Disable - ### How to Set it to Show Only the Translation -Set this in the `Rules Setting`: RULES -> Global Rule -> Show Only Translations -> Enable - -### How to Set Mouse Hover Translation - -Set this in the `Rules Setting`: RULES -> Global Rule -> TTrigger Mode - -### Why are some web pages not fully translated? - -This extension's webpage translation is based on CSS selectors. Generic rules cannot adapt to all websites, and sometimes you need to manually add site-specific rules. If you don't know how to write rules, you can seek help here: -https://github.com/fishjar/kiss-rules/issues +`Rules Setting`: Show Only Translations -> Enable ### What is the priority order of rule settings? -Personal Rules > Override Subscription Rules > Subscription Rules > Global Rules +Personal Rules > Subscription Rules > Global Rules Among these, Global Rules have the lowest priority but are very important as they serve as the default rules. -### Why are YouTube subtitles translated in broken sentences? - -This extension has no special development for video content. Support for YouTube is also treated as regular webpage translation. Auto-generated subtitles are streamed and output progressively, resulting in poorer support. - -To disable this extension's subtitle translation, add a rule. Reference: https://github.com/fishjar/kiss-translator/issues/62 - ### Local Ollama interface cannot be used If encountering a 403 error, refer to: https://github.com/fishjar/kiss-translator/issues/174 @@ -172,55 +163,15 @@ Tampermonkey scripts require adding domains to the whitelist; otherwise, request The custom interface feature is highly flexible and can theoretically integrate with any translation interface. -Example of a Request Hook function: - -```js -/** - * Request Hook - * @param {string} text Text to be translated - * @param {string} from Source language - * @param {string} to Target language - * @param {string} url Translation interface URL - * @param {string} key Translation interface API key - * @returns {Array[string, object]} [Interface URL, request object] - */ -(text, from, to, url, key) => [url, { - headers: { - "Content-type": "application/json", - "Authorization": `Bearer ${key}` - }, - method: "POST", - body: { text, to }, -}] -``` - -Example of a Response Hook function: - -```js - * Response Hook - * @param {string} res JSON data returned by the interface - * @param {string} text Text to be translated - * @param {string} from Source language - * @param {string} to Target language - * @returns {Array[string, boolean]} [Translated text, whether target language is same as source] - * Note: If the second return value is true (target language same as source), - * the translation will not be displayed on the page, - * If the parameters are incomplete, it is recommended to return false directly - */ -(res, text, from, to) => [res.text, to === res.src] -``` - -For more custom interface examples, refer to: [custom-api.md](https://github.com/fishjar/kiss-translator/blob/master/custom-api.md) - ## Future Plans This is a side project with no strict timeline. Community contributions are welcome. The following are preliminary feature directions: -- [ ] **Batch Text Requests**: Optimize request strategy to reduce translation API calls and improve performance. -- [ ] **Enhanced Rich Text Translation**: Support accurate translation of complex page structures and rich text content. -- [ ] **Advanced Custom/AI Interfaces**: Add support for context memory, multi-turn conversations, and other advanced AI features. -- [ ] **Fallback English Dictionary**: When translation services fail, fall back to a local dictionary lookup. -- [ ] **Improved YouTube Subtitle Support**: Enhance merging and translation experience for streaming subtitles, reducing sentence fragmentation. +- [x] **Batch Text Requests**: Optimize request strategy to reduce translation API calls and improve performance. +- [x] **Enhanced Rich Text Translation**: Support accurate translation of complex page structures and rich text content. +- [x] **Advanced Custom/AI Interfaces**: Add support for context memory, multi-turn conversations, and other advanced AI features. +- [x] **Fallback English Dictionary**: When translation services fail, fall back to a local dictionary lookup. +- [x] **Improved YouTube Subtitle Support**: Enhance merging and translation experience for streaming subtitles, reducing sentence fragmentation. - [ ] **Upgraded Rule Collaboration System**: Introduce more flexible rule sharing, version management, and community review processes. If you're interested in any of these directions, feel free to discuss in [Issues](https://github.com/fishjar/kiss-translator/issues) or submit a PR! diff --git a/README.md b/README.md index a38a54b..992ad7f 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,14 @@ > - 自动识别文本模式使得绝大部分网站无需编写规则也能翻译完整。 > - 保留之前的手动规则模式,可以针对特定网站极致优化。 > - 支持富文本翻译,能够尽量保留原文中的链接及其他文本样式。 +> - 优化仅显示译文(隐藏原文)显示效果。 > - 接口重构: > - 支持添加、删除任意数量的接口。 > - 支持聚合发送文本,减少翻译接口调用次数,提升性能。 > - 支持chrome内置AI翻译接口,无需通过网络即可实现AI翻译。 > - 支持AI上下文会话记忆功能,提升翻译效果。 > - 所有接口均支持Hook和自定义参数等高级功能。 +> - 新增Azure AI翻译接口支持 > - 优化 YouTube 字幕支持: > - 支持任意翻译服务对视频字幕进行翻译并双语显示。 > - 内置基础的字幕合并与断句算法,提升翻译效果。 @@ -48,24 +50,36 @@ - [x] Thunderbird - [x] 支持多种翻译服务 - [x] Google/Microsoft - - [x] Baidu/Tencent/Volcengine - - [x] OpenAI/Gemini/Claude/Ollama/DeepSeek/CloudflareAI + - [x] Tencent/Volcengine + - [x] OpenAI/Gemini/Claude/Ollama/DeepSeek/OpenRouter - [x] DeepL/DeepLX/NiuTrans + - [x] BuiltinAI/AzureAI/CloudflareAI - [x] 自定义翻译接口 - [x] 覆盖常见翻译场景 - [x] 网页双语对照翻译 - [x] 输入框翻译 - [x] 划词翻译 + - [x] 任意页面打开翻译框 - [x] 收藏词汇 - [x] 鼠标悬停翻译 - [x] YouTube 字幕翻译 +- [x] 支持多样翻译效果 + - [x] 自定识别文本,全文翻译 + - [x] 自定义译文样式 + - [x] 支持富文本翻译及显示 + - [x] 支持仅显示译文(隐藏原文) +- [x] 翻译接口高级功能 + - [x] 聚合批量发送翻译文本 + - [x] AI上下文会话记忆 + - [x] 自定义AI术语词典 + - [x] 字幕文本AI智能断句及翻译 + - [x] 自定义Hook,自定义参数 - [x] 跨客户端数据同步 - [x] KISS-Worker(cloudflare/docker) - [x] WebDAV - [x] 自定义翻译规则 - [x] 规则订阅/规则分享 - [x] 自定义专业术语 -- [x] 自定义译文样式 - [x] 自定义快捷键 - `Alt+Q` 开启翻译 - `Alt+C` 切换样式 @@ -78,7 +92,7 @@ > 注:基于以下原因,建议优先使用浏览器扩展 > -> - 浏览器扩展的功能更完整(本地语言识别、右键菜单等) +> - 浏览器扩展的功能更完整(字幕翻译、本地语言识别、右键菜单等) > - 油猴脚本会遇到更多使用上的问题(跨域问题、脚本冲突等) - [x] 浏览器扩展 @@ -105,9 +119,6 @@ - 社区订阅规则: [https://github.com/fishjar/kiss-rules](https://github.com/fishjar/kiss-rules) - 提供社区维护的,最新最全的订阅规则列表。 - 求助规则相关的问题。 -- 翻译接口代理: [https://github.com/fishjar/kiss-proxy](https://github.com/fishjar/kiss-proxy) - - 如果访问某个翻译接口遇到网络问题,这个代理服务也许可以帮到你。 - - 自己部署,自己管理。 ## 常见问题 @@ -115,9 +126,8 @@ 通过规则设置,以下方法均可实现: -- 个人规则:全局规则 -> 开启翻译 -> 默认关闭 -- 订阅规则:选择第三个 `kiss-rules-off.json` -- 覆写订阅规则:开启翻译 -> 默认关闭 +- 全局规则 -> 开启翻译 -> 默认关闭 +- 订阅规则选择第三个 `kiss-rules-off_v2.json` - 添加一条针对某个网站的个人规则:开启翻译 -> 默认关闭 ### 如何设置快捷键 @@ -127,33 +137,15 @@ - chrome [chrome://extensions/shortcuts](chrome://extensions/shortcuts) - firefox [about:addons](about:addons) -### 如何关闭划词翻译 - -通过规则设置:个人规则 -> 全局规则 -> 是否启用划词翻译 -> 禁用 - ### 如何设置仅显示译文 -通过规则设置:个人规则 -> 全局规则 -> 仅显示译文 -> 启用 - -### 如何设置鼠标悬停翻译 - -通过规则设置:个人规则 -> 全局规则 -> 触发方式 - -### 为什么有些网页翻译不全 - -本插件的网页翻译是基于CSS选择器的,通用规则不能适配所有网页,有时需要自行添加相应网站的单独规则。如果不会写规则,可以到这里求助: https://github.com/fishjar/kiss-rules/issues +规则设置:仅显示译文 -> 启用 ### 规则设置的优先级是如何的 -个人规则 > 覆写订阅规则 > 订阅规则 > 全局规则 +个人规则 > 订阅规则 > 全局规则 -其中全局规则优先级最低,但非常重要,相当于默认规则。 - -### 为什么油管字幕一句话会断开翻译 - -本插件目前没有针对视频做特殊开发,对油管的支持也是当做网页翻译看待,自动生成字幕是流式生成并输出的,所以支持较差。 - -如果需要关闭本插件的字幕翻译,增加一条规则即可,参考:https://github.com/fishjar/kiss-translator/issues/62 +其中全局规则优先级最低,但非常重要,相当于兜底规则。 ### 本地的Ollama接口不能使用 @@ -167,46 +159,6 @@ 自定义接口功能非常灵活,理论可以接入任何翻译接口。 -Request Hook 函数示例如下: - -```js -/** - * Request Hook - * @param {string} text 需要翻译的原文 - * @param {string} from 原文语言 - * @param {string} to 译文语言 - * @param {string} url 翻译接口地址 - * @param {string} key 翻译接口密钥 - * @returns {Array[string, object]} [接口地址, 请求参数对象] - */ -(text, from, to, url, key) => [url, { - headers: { - "Content-type": "application/json", - "Authorization": `Bearer ${key}` - }, - method: "POST", - body: { text, to }, -}] -``` - -Response Hook 函数示例如下: - -```js -/** - * Request Hook - * @param {string} res 接口返回的json数据 - * @param {string} text 需要翻译的原文 - * @param {string} from 原文语言 - * @param {string} to 译文语言 - * @returns {Array[string, boolean]} [译文, 译文语言与原文语言是否相同] - * 注:如果返回值第二个值为true(译文语言与原文语言相同)则译文不会在页面显示, - * 参数不全的情况建议直接返回false - */ -(res, text, from, to) => [res.text, to === res.src] -``` - -更多的自定义接口示例,请参考: [custom-api.md](https://github.com/fishjar/kiss-translator/blob/master/custom-api.md) - ## 未来规划 本项目为业余开发,无严格时间表,欢迎社区共建。以下为初步设想的功能方向: diff --git a/custom-api.md b/custom-api.md index c1e54ef..e358c21 100644 --- a/custom-api.md +++ b/custom-api.md @@ -1,5 +1,7 @@ # 自定义接口示例 +> **本文档已过期,新版不再适用** + 以下示例为网友提供,仅供学习参考。 ## 本地运行 Seed-X-PPO-7B 量化模型 diff --git a/src/config/i18n.js b/src/config/i18n.js index f2f6a33..eecd6e9 100644 --- a/src/config/i18n.js +++ b/src/config/i18n.js @@ -158,7 +158,7 @@ async (args, { url, body, headers, userMsg, method } = {}) => { const responsetHookHelperZH = `1、第一个参数包含如下字段:'res', ... 2、返回值必须是包含以下字段的对象: 'translations', 'modelMsg' - ('translations' 应为一个二维数组,表示 [译文,源语言] 的列表) + ('translations' 应为一个二维数组:[[译文, 源语言]]) 3、如返回空值,则hook函数不会产生任何效果。 // 示例 @@ -171,7 +171,7 @@ async ({ res, ...args }) => { const responsetHookHelperEN = `1. The first parameter contains the following fields: 'res', ... 2. The return value must be an object containing the following fields: 'translations', 'modelMsg' - ('translations' should be a two-dimensional array representing a list of [translation, source language]). + ('translations' should be a two-dimensional array: [[translation, source language]]). 3. If a null value is returned, the hook function will have no effect. // Example @@ -495,14 +495,14 @@ export const I18N = { zh_TW: `訂閱網址`, }, rules_warn_1: { - zh: `1、“个人规则”一直生效,选择“注入订阅规则”后,“订阅规则”才会生效。`, - en: `1. The "Personal Rules" are always in effect. After selecting "Inject Subscription Rules", the "Subscription Rules" will take effect.`, - zh_TW: `1.「個人規則」會一直生效;選擇「注入訂閱規則」後,「訂閱規則」才會生效。`, + zh: `1、规则生效的优先级依次为:个人规则 > 订阅规则 > 全局规则。"全局规则"相当于兜底规则。`, + en: `1. The priority of rules is: personal rules > subscription rules > global rules. "Global rules" are like a fallback rule.`, + zh_TW: `1.規則生效的優先順序依序為:個人規則 > 訂閱規則 > 全域規則。 "全域規則"相當於兜底規則。`, }, rules_warn_2: { - zh: `2、“订阅规则”的注入位置是倒数第二的位置,因此除全局规则(*)外,“个人规则”优先级比“订阅规则”高,“个人规则”填写同样的网址会覆盖”订阅规则“的条目。`, - en: `2. The injection position of "Subscription Rules" is the penultimate position. Therefore, except for the global rules (*), the priority of "Personal Rules" is higher than that of "Subscription Rules". Filling in the same url in "Personal Rules" will overwrite "Subscription Rules" entry.`, - zh_TW: `2.「訂閱規則」的注入位置為倒數第二位,故除全域規則 (*) 外,「個人規則」優先於「訂閱規則」。在「個人規則」填入相同網址時會覆蓋「訂閱規則」的條目。`, + zh: `2、“订阅规则”选择注入后才会生效。`, + en: `2. "Subscription rules" will take effect only after injection is selected.`, + zh_TW: `2、「訂閱規則」選擇注入後才會生效。`, }, rules_warn_3: { zh: `3、关于规则填写:输入框留空或下拉框选“*”表示采用全局规则。`, @@ -530,6 +530,11 @@ export const I18N = { zh_TW: `1.其中 BuiltinAI 為瀏覽器內建AI翻譯,目前僅 Chrome 138 以上版本支援。`, }, about_api_2: { + zh: `2、大部分AI接口都与OpenAI兼容,因此选择添加OpenAI类型即可。`, + en: `2. Most AI interfaces are compatible with OpenAI, so just choose to add the OpenAI type.`, + zh_TW: `2.大部分AI介面都與OpenAI相容,因此選擇新增OpenAI類型即可。`, + }, + about_api_3: { zh: `2、暂未列出的接口,理论上都可以通过自定义接口 (Custom) 的形式支持。`, en: `2. Interfaces that have not yet been launched can theoretically be supported through custom interfaces.`, zh_TW: `2、暫未列出的介面,理論上都可透過自訂介面 (Custom) 的形式支援。`, @@ -539,6 +544,11 @@ export const I18N = { en: `Check out the self-built translation interface proxy`, zh_TW: `查看如何自建翻譯介面 Proxy`, }, + setting_helper: { + zh: `新旧配置并不兼容,导出的旧版配置,勿再次导入。`, + en: `The old and new configurations are not compatible. Do not import the exported old configuration again.`, + zh_TW: `新舊配置並不相容,匯出的舊版配置,勿再次匯入。`, + }, style_none: { zh: `无`, en: `None`, @@ -1584,14 +1594,19 @@ export const I18N = { zh_TW: `AI处理切割长度(200-20000)`, }, subtitle_helper_1: { - zh: `1、目前仅支持Youtube,且仅支持浏览器扩展。`, - en: `1. Currently only supports Youtube and browser extensions.`, - zh_TW: `1.目前僅支援Youtube,且僅支援瀏覽器擴充功能。`, + zh: `1、目前仅支持Youtube桌面网站,且仅支持浏览器扩展。`, + en: `1. Currently only supports Youtube desktop website and browser extension.`, + zh_TW: `1.目前僅支援Youtube桌面網站,且僅支援瀏覽器擴充功能。`, }, subtitle_helper_2: { - zh: `2、插件内置基础的合并、断句算法,如不理想,可以启用AI智能断句,但需考虑切割长度与AI接口的处理能力,可能等待的时间会很长,甚至失败。`, - en: `2. The plug-in has built-in basic merging and segmentation algorithms. If the results are not ideal, you can enable AI intelligent segmentation. However, you need to consider the cutting length and the processing capacity of the AI ​​interface. The waiting time may be very long or even fail.`, - zh_TW: `2.插件內建基礎的合併、斷句演算法,如不理想,可以啟用AI智慧斷句,但需考慮切割長度與AI介面的處理能力,可能等待的時間會很長,甚至失敗。`, + zh: `2、插件内置基础的字幕合并、断句算法,可满足大部分情况。`, + en: `2. The plug-in has built-in basic subtitle merging and sentence segmentation algorithms, which can meet most situations.`, + zh_TW: `2.插件內建基礎的字幕合併、斷句演算法,可滿足大部分情況。`, + }, + subtitle_helper_3: { + zh: `3、亦可以启用AI智能断句,但需考虑切割长度及AI接口能力,可能处理时间会很长,甚至处理失败,导致无法看到字幕。`, + en: `3. You can also enable AI intelligent segmentation, but you need to consider the segmentation length and AI interface capabilities. The processing time may be very long or even fail, resulting in the inability to see subtitles.`, + zh_TW: `3.亦可啟用AI智能斷句,但需考慮切割長度及AI介面能力,可能處理時間會很長,甚至處理失敗,導致無法看到字幕。`, }, default_styles_example: { zh: `默认样式参考:`, diff --git a/src/libs/translator.js b/src/libs/translator.js index aed7c7f..d3521bb 100644 --- a/src/libs/translator.js +++ b/src/libs/translator.js @@ -22,7 +22,7 @@ import { import interpreter from "./interpreter"; import { ShadowRootMonitor } from "./shadowroot"; import { clearFetchPool } from "./pool"; -import { debounce, scheduleIdle, genEventName } from "./utils"; +import { debounce, scheduleIdle, genEventName, truncateWords } from "./utils"; import { apiTranslate } from "../apis"; import { sendBgMsg } from "./msg"; import { isExt } from "./client"; @@ -543,8 +543,8 @@ export class Translator { #getDocDescription() { try { const meta = document.querySelector('meta[name="description"]'); - const description = meta ? meta.getAttribute("content") : ""; - return description.slice(0, 200); + const description = meta?.getAttribute("content") || ""; + return truncateWords(description); } catch (err) { kissLog("get description", err); } diff --git a/src/views/Options/Apis.js b/src/views/Options/Apis.js index 4d93ebb..f80af09 100644 --- a/src/views/Options/Apis.js +++ b/src/views/Options/Apis.js @@ -803,6 +803,8 @@ export default function Apis() { {i18n("about_api")}
{i18n("about_api_2")} +
+ {i18n("about_api_3")} diff --git a/src/views/Options/Setting.js b/src/views/Options/Setting.js index 6cfa5e6..83a03cf 100644 --- a/src/views/Options/Setting.js +++ b/src/views/Options/Setting.js @@ -8,6 +8,7 @@ import { useI18n } from "../../hooks/I18n"; import { useAlert } from "../../hooks/Alert"; import { isExt } from "../../libs/client"; import Grid from "@mui/material/Grid"; +import Alert from "@mui/material/Alert"; import { UI_LANGS, TRANS_NEWLINE_LENGTH, @@ -110,6 +111,8 @@ export default function Settings() { return ( + {i18n("setting_helper")} + {i18n("subtitle_helper_2")} +
+ {i18n("subtitle_helper_3")}