diff --git a/src/config/i18n.js b/src/config/i18n.js
index a92d3fa..e5df957 100644
--- a/src/config/i18n.js
+++ b/src/config/i18n.js
@@ -60,6 +60,10 @@ export const I18N = {
zh: `最大翻译长度 (100-10000)`,
en: `Max Translate Length (100-10000)`,
},
+ num_of_newline_characters: {
+ zh: `换行字符数 (1-1000)`,
+ en: `Number of Newline Characters (1-1000)`,
+ },
translate_service: {
zh: `翻译服务`,
en: `Translate Service`,
diff --git a/src/config/index.js b/src/config/index.js
index b8e8dcd..1156c19 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -167,6 +167,7 @@ export const DEFAULT_SUBRULES_LIST = [
export const TRANS_MIN_LENGTH = 5; // 最短翻译长度
export const TRANS_MAX_LENGTH = 5000; // 最长翻译长度
+export const TRANS_NEWLINE_LENGTH = 40; // 换行字符数
export const DEFAULT_SETTING = {
darkMode: false, // 深色模式
@@ -175,6 +176,7 @@ export const DEFAULT_SETTING = {
fetchInterval: DEFAULT_FETCH_INTERVAL, // 任务间隔时间
minLength: TRANS_MIN_LENGTH,
maxLength: TRANS_MAX_LENGTH,
+ newlineLength: TRANS_NEWLINE_LENGTH,
clearCache: false, // 是否在浏览器下次启动时清除缓存
injectRules: true, // 是否注入订阅规则
subrulesList: DEFAULT_SUBRULES_LIST, // 订阅列表
diff --git a/src/views/Content/index.js b/src/views/Content/index.js
index 745a0ae..2c8066d 100644
--- a/src/views/Content/index.js
+++ b/src/views/Content/index.js
@@ -10,6 +10,7 @@ import {
DEFAULT_COLOR,
EVENT_KISS,
MSG_TRANS_CURRULE,
+ TRANS_NEWLINE_LENGTH,
} from "../../config";
import { useTranslate } from "../../hooks/Translate";
@@ -19,6 +20,8 @@ export default function Content({ q, translator }) {
const { text, sameLang, loading } = useTranslate(q, rule, translator.setting);
const { textStyle, bgColor } = rule;
+ const { newlineLength = TRANS_NEWLINE_LENGTH } = translator.setting;
+
const handleMouseEnter = () => {
setHover(true);
};
@@ -87,7 +90,7 @@ export default function Content({ q, translator }) {
if (loading) {
return (
<>
- {q.length > 40 ?
: " "}
+ {q.length > newlineLength ?
: " "}
>
);
@@ -96,7 +99,7 @@ export default function Content({ q, translator }) {
if (text && !sameLang) {
return (
<>
- {q.length > 40 ?
: " "}
+ {q.length > newlineLength ?
: " "}
+
+
{i18n("clear_cache")}