diff --git a/base-core/src/main/java/com/funny/translation/helper/TextSplitter.kt b/base-core/src/main/java/com/funny/translation/helper/TextSplitter.kt
index ed7a2cbe..fffce84c 100644
--- a/base-core/src/main/java/com/funny/translation/helper/TextSplitter.kt
+++ b/base-core/src/main/java/com/funny/translation/helper/TextSplitter.kt
@@ -55,8 +55,7 @@ object TextSplitter {
for(puncs in hierarchyPunctuations) {
val idx = text.rfind(puncs, 0, text.length - 1)
if (idx != -1) {
- // 由于大多数情况下,这个分隔符是换行符,所以这里直接返回 idx,换行符留给下一次作为输入,尽量保持格式
- return text.substring(0, idx)
+ return text.substring(0, idx + 1)
}
}
return text
diff --git a/translate/src/main/java/com/funny/translation/translate/ui/long_text/LongTextTransViewModel.kt b/translate/src/main/java/com/funny/translation/translate/ui/long_text/LongTextTransViewModel.kt
index 436aeb06..9024719a 100644
--- a/translate/src/main/java/com/funny/translation/translate/ui/long_text/LongTextTransViewModel.kt
+++ b/translate/src/main/java/com/funny/translation/translate/ui/long_text/LongTextTransViewModel.kt
@@ -44,12 +44,8 @@ import org.json.JSONObject
import java.util.UUID
-const val DEFAULT_PROMPT_PREFIX = """你现在是一名优秀的翻译人员,现在在翻译长文中的某个片段。请根据给定的术语表,将输入文本翻译成中文"""
-const val DEFAULT_PROMPT_SUFFIX = """,并找出可能存在的新术语。你的输出分为两部分,以||sep||分割,前半部分是翻译结果,后半部分是关键词,以JSON数组的形式,无则为[]
-示例输入:XiaoHong and XiaoMing are studying DB class.||sep||[["DB","数据库"],["XiaoHong","萧红"]]
-示例输出:萧红和晓明正在学习数据库课程||sep||[["XiaoMing","晓明"]]
-
-保持译文和原文格式一致,正确输出换行"""
+val DEFAULT_PROMPT_PREFIX = string(R.string.default_long_text_trans_prompt_prefix)
+val DEFAULT_PROMPT_SUFFIX = string(R.string.default_long_text_prompt_suffix)
private val DEFAULT_PROMPT = EditablePrompt(DEFAULT_PROMPT_PREFIX, DEFAULT_PROMPT_SUFFIX)
diff --git a/translate/src/main/res/values-en/strings.xml b/translate/src/main/res/values-en/strings.xml
index 38b5b2c8..3dff341f 100644
--- a/translate/src/main/res/values-en/strings.xml
+++ b/translate/src/main/res/values-en/strings.xml
@@ -328,4 +328,6 @@
Unparseable error output:
Prompt specifies the task of the model, which can greatly affect the quality of translation. If there are special requirements (such as language, expression, professional field, etc.), it is recommended to specify,\n\nIt must be related to foreign language learning and translation, and judgment will be made during modification. Whether the judgment passes or not, the points used for judgment will be deducted. Please modify it carefully
Dark Mode
+ You are now an excellent translator, working on translating a fragment of a long text. Please translate the input text into English according to the given terminology list.
+ Also, identify any potential new terminology. Your output consists of two parts, separated by ||sep||. The first part is the translation result, and the second part is the keywords in the form of a JSON array. If there are no keywords, it should be [].\nExample input: XiaoHong and XiaoMing are studying DB class.||sep||[[\"DB\",\"数据库\"],[\"XiaoHong\",\"萧红\"]]\nExample output: 萧红和晓明正在学习数据库课程||sep||[[\"XiaoMing\",\"晓明\"]]\n\nPlease maintain the format of the translated text consistent with the original text and correctly output all line breaks.
\ No newline at end of file
diff --git a/translate/src/main/res/values/strings.xml b/translate/src/main/res/values/strings.xml
index 435fb38b..9266b735 100644
--- a/translate/src/main/res/values/strings.xml
+++ b/translate/src/main/res/values/strings.xml
@@ -328,4 +328,6 @@
无法解析的错误输出:
Prompt指定了模型的任务,它能很大程度上影响翻译质量。如果有特殊的需求(比如语种、表达方式、专业领域等),建议指定、\n\n必须和外语类学习、翻译相关,修改时会进行判定。无论判定是否通过,均会扣除判定所用的点数,谨慎修改
深色模式
+ 你现在是一名优秀的翻译人员,现在在翻译长文中的某个片段。请根据给定的术语表,将输入文本翻译成中文
+ ,并找出可能存在的新术语。你的输出分为两部分,以||sep||分割,前半部分是翻译结果,后半部分是关键词,以JSON数组的形式,无则为[]\n示例输入:XiaoHong and XiaoMing are studying DB class.||sep||[[\"DB\",\"数据库\"],[\"XiaoHong\",\"萧红\"]]\n示例输出:萧红和晓明正在学习数据库课程||sep||[[\"XiaoMing\",\"晓明\"]]\n\n保持译文和原文格式一致,正确输出换行
\ No newline at end of file