Skip to content

Commit 41eb1e3

Browse files
authored
feat(locales): add new translation keys and update Chinese locale (#53)
1 parent bb51649 commit 41eb1e3

4 files changed

Lines changed: 34 additions & 26 deletions

File tree

oo-locales/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@
2525
"the-entire-book-will-be-split-into-many-chunks-and-submitted-to": "The entire book will be split into many chunks and submitted to LLM in batches. this number is used to limit the number of tokens in each chunk.",
2626
"the-number-of-threads-opened-at-the-same-time-to-initiate-reques": "The number of threads opened at the same time to initiate requests to LLM, the more threads, the faster the analysis speed.",
2727
"the-number-of-retries-after-an-llm-request-fails-is-limited-if-a": "The number of retries after an LLM request fails is limited. If a request exceeds this number, an error will be reported and the request will be exited.",
28-
"how-long-in-seconds-after-a-failed-llm-request-starts-the-next-r": "How long (in seconds) after a failed LLM request starts the next retry"
28+
"how-long-in-seconds-after-a-failed-llm-request-starts-the-next-r": "How long (in seconds) after a failed LLM request starts the next retry",
29+
"display-name3": "Book translator",
30+
"description3": "Use LLM to translate EPUB e-books, while retaining the original text and the translated text, to achieve a bilingual reading experience.",
31+
"translated-epub-file-path": "EPUB file path has been translated."
2932
}

oo-locales/zh-CN.json

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
{
2-
"translate-the-epub-book-using-llm-side-by-side": "使用大语言模型(LLM)翻译EPUB电子书。翻译后的书籍将保留原文,并在原文旁边显示译文。",
3-
"books-translator": "图书翻译",
4-
"books-translator1": "图书翻译",
5-
"use-llm-to-translate-epub-e-books-the-translated-book-will-retai": "使用大语言模型(LLM)翻译EPUB电子书。翻译后的书籍将保留原文,并在原文旁边显示译文。",
6-
"playground": "Playground",
2+
"display-name": "图书翻译员",
3+
"description": "使用 LLM 并排翻译 epub 书籍。",
4+
"playground": "操场",
75
"translate-a-book-1": "翻译一本书 #1",
6+
"comment:+comment-1751874375575:title": "主要字段",
7+
"comment:+comment-1751874833250:title": "自定义提示词",
8+
"comment:+comment-1751874833250:content": "`prompt` 可填入提示词,以为 LLM 翻译书籍提供必要信息。例如,你可以将术语表和人物名称规范填入其中。用自然语言描述告知 LLM 即可。",
9+
"comment:+comment-1751874949570:title": "输出字段",
10+
"comment:+comment-1751874949570:content": "`translated_file` 翻译后的文件保存路径。",
11+
"comment:+comment-1751875005817:title": "额外字段",
12+
"comment:+comment-1751875005817:content": "> 下列字段若不想了解,保留原始值即可。\n- `max_chunk_tokens`: 翻译分段时,限制每段的最大 tokens 数。由于 LLM 的特性,不可能将整本书一次性输入大语言模型来翻译。因此,会将书籍分段提交给 LLM。这个参数用于限制每一段的最大长度(单位是 token)。\n- `threads`: 并发发起翻译请求。如果你觉得翻译过慢,可以将这个值调高。但建议不要超过 16 路并发,会触发 LLM 供应商的限流策略。\n- `retry_times`: 同一分段连续失败多少次之后,才宣布失败。\n- `retry_interval_seconds`: 重试失败后,间隔多少秒后再次重试。",
13+
"comment:+comment-1751875472639:title": "中断续译",
14+
"comment:+comment-1751875472639:content": "翻译同一本书时,如果主动中断或因为网络原因中断后,已翻译的进度不会丢失。继续点运行后,可以从上一次翻译的进度继续翻译。",
815
"translate-a-book": "翻译一本书",
9-
"use-llm-to-translate-epub-ebooks-the-translated-book-will-retain": "使用 LLM 翻译 epub 电子书。翻译后的书籍将保留原文,并将译文与原文并排列出。",
16+
"display-name2": "图书翻译员",
17+
"description2": "将你喜欢的书籍转换成你想阅读的任何语言,让来自世界各地的文学作品以你喜欢的语言变得触手可及。",
18+
"comment:+comment-1751874375575:content": "在大多数情况下,您只需要配置这三个字段即可完全运行所有内容。\n- `source_file`:要翻译的原始 EPUB 文件\n- `translated_file`:保存已翻译 EPUB 文件的位置(如果未指定,将保存在 `session_dir`)\n- `language`:目标翻译语言",
19+
"translate-a-book2": "翻译一本书",
20+
"translated-epub-file-path": "已翻译 EPUB 文件路径。",
21+
"display-name3": "图书翻译员",
22+
"description3": "使用 LLM 翻译 EPUB 电子书,同时保留原文与翻译文本,实现双语阅读体验。",
23+
"use-llm-to-translate-epub-ebooks-the-translated-book-will-retain": "使用 LLM 翻译 epub 电子书。翻译后的书籍将保留原文,并将译文与原文并排显示。",
1024
"the-original-epub-file-to-be-translated": "要翻译的原始 EPUB 文件",
1125
"the-saved-path-of-the-translated-epub-file-if-not-filled-in-spec": "已翻译 EPUB 文件的保存路径。如果未填写,请指定一个路径。",
1226
"translation-target-language": "翻译目标语言",
13-
"how-is-the-translation-written-into-an-epub-file-is-it-append-to": "翻译是如何写入 EPUB 文件的:是“附加”到原文后面,还是“替换”原文?",
14-
"provide-llm-with-necessary-information-for-translating-books-for": "为 LLM 提供翻译书籍所需的信息。例如,你可以填写术语表和角色名称规范。只需用自然语言描述告诉 LLM 即可。",
27+
"how-is-the-translation-written-into-an-epub-file-is-it-append-to": "翻译是如何写入 EPUB 文件的:是“附加”在原文后面,还是“替换”原文?",
28+
"provide-llm-with-necessary-information-for-translating-books-for": "为 LLM 提供翻译书籍所需的信息。例如,你可以填写词汇表和角色名字规范。只需用自然语言描述告诉 LLM 即可。",
1529
"the-entire-book-will-be-split-into-many-chunks-and-submitted-to": "整本书将被拆分成多个部分,并分批提交给 LLM。这个数字用于限制每个部分中的 token 数量。",
16-
"the-number-of-threads-opened-at-the-same-time-to-initiate-reques": "同时开启用于向 LLM 发起请求的线程数量,线程越多,分析速度越快。",
17-
"the-number-of-retries-after-an-llm-request-fails-is-limited-if-a": "在 LLM 请求失败后,重试的次数是有限的。如果某个请求超过了这个次数,将会报错并退出该请求。",
18-
"how-long-in-seconds-after-a-failed-llm-request-starts-the-next-r": "在一次 LLM 请求失败后,下一次重试会在多少秒后开始",
19-
"comment:+comment-1751874375575:title": "主要领域",
20-
"comment:+comment-1751874375575:content": "在大多数情况下,您只需配置这三个字段即可正常运行所有内容。\n- `source_file`:要翻译的原始 EPUB 文件\n- `translated_file`:保存翻译后 EPUB 文件的位置(如果留空,将保存在 `session_dir` 中)\n- `language`:翻译的目标语言",
21-
"comment:+comment-1751874833250:title": "自定义提示",
22-
"comment:+comment-1751874833250:content": "“prompt” 字段可以填写提示,用于为 LLM 提供翻译书籍所需的信息。例如,你可以输入标准化的词汇表和角色名称。只需用自然语言描述并告知 LLM 即可。",
23-
"comment:+comment-1751874949570:title": "输出字段",
24-
"comment:+comment-1751874949570:content": "`translated_file` 翻译文件的保存路径。",
25-
"comment:+comment-1751875005817:title": "额外字段",
26-
"comment:+comment-1751875005817:content": "如果你不希望修改以下字段,只需保留它们的原始值。\n\n- `max_chunk_tokens`:在分段翻译时,此参数限制每个分段的最大 token 数。由于大语言模型(LLM)的特性,不可能一次性将整本书输入到大语言模型中进行翻译。因此,书籍会被分割成多个片段并提交给 LLM。本参数用于限制每个片段的最大长度(以 token 计)。\n- `threads`:并发翻译请求的数量。如果你觉得翻译速度太慢,可以增加此值。但建议不要超过 16 个并发线程,否则可能会触发 LLM 提供商的限流。\n- `retry_times`:同一片段连续失败的次数达到该值后,才会被判定为失败。\n- `retry_interval_seconds`:每次失败后,重试前需要等待的秒数。",
27-
"comment:+comment-1751875472639:title": "中断 口译",
28-
"comment:+comment-1751875472639:content": "在翻译同一本书时,如果你主动中断了过程,或者由于网络问题而被中断,你已经完成的进度不会丢失。点击“运行”继续后,你可以从上次中断的地方继续翻译。"
30+
"the-number-of-threads-opened-at-the-same-time-to-initiate-reques": "同时开启的用于向 LLM 发起请求的线程数,线程越多,分析速度越快。",
31+
"the-number-of-retries-after-an-llm-request-fails-is-limited-if-a": "在 LLM 请求失败后,重试的次数是有限的。如果某个请求超过了这个次数,将会报错并结束该请求。",
32+
"how-long-in-seconds-after-a-failed-llm-request-starts-the-next-r": "在一次失败的 LLM 请求之后,下一次重试会在多少秒后开始"
2933
}

package.oo.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ scripts:
77
poetry install --no-root
88
dependencies:
99
{}
10-
name: books-translator
10+
name: books_translator
1111
version: 0.2.0
12-
displayName: "%books-translator1%"
13-
description: "%use-llm-to-translate-epub-e-books-the-translated-book-will-retai%"
12+
displayName: "%display-name3%"
13+
description: "%description3%"
1414
releaseNotes: support the write_mode field
1515
repository: https://github.com/oomol-flows/books-translator

tasks/translator/task.oo.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ inputs_def:
102102
minimum: 0
103103
value: 6.5
104104
- handle: model
105+
description: "%llm-model-configuration%"
105106
json_schema:
106107
ui:options:
107108
title: Model
@@ -113,7 +114,7 @@ inputs_def:
113114
max_tokens: 4096
114115
outputs_def:
115116
- handle: translated_file
116-
description: Translated EPUB file path.
117+
description: "%translated-epub-file-path%"
117118
json_schema:
118119
type: string
119120
ui:widget: save

0 commit comments

Comments
 (0)