![KLEIROF-Auto_Translate icon](https://gcdn.thunderstore.io/live/repository/icons/KLEIROF-Auto_Translate-1.0.5.png.128x128_q95.png)
Auto Translate
允许用一些线上翻译api翻译游戏内文字为其支持的语言。使用前请阅读申明。反馈至GitHub。 Allows the use of some online translation APIs to translate in-game texts into their supported languages. Please read the declaration before use. Submit issues on GitHub.
Last updated | 2 days ago |
Total downloads | 79 |
Total rating | 0 |
Categories | Mods Misc QoL |
Dependency string | KLEIROF-Auto_Translate-1.0.5 |
Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
![MtG_API-Mod_the_Gungeon_API-1.9.2 icon](https://gcdn.thunderstore.io/live/repository/icons/MtG_API-Mod_the_Gungeon_API-1.9.2.png.64x64_q95.png)
MtG_API-Mod_the_Gungeon_API
Adds the good parts of Mod the Gungeon to BepInEx.
Preferred version: 1.9.2README
自动翻译 AutoTranslate
1. 声明(重要)
- 本 mod 为 EtG 提供对一些线上翻译 api 的支持,可以翻译游戏内文字为翻译 api 支持的语言。
- 本 mod 的作者不收取任何费用,但是使用网络翻译 api 可能产生费用,由相应 api 的服务商收取。不是所有的翻译请求都会产生费用,多数翻译 api 有免费额度,如每月 100 万字符到 500 万字符不等,请查阅使用的 api 的定价标准。如过量使用网络翻译 api 从而产生账单,本 mod 作者不承担任何责任。
- 使用本 mod 需要向翻译 api 服务商申请服务获得密钥,具体请查阅翻译 api 服务商的文档。
- 本 mod 的网络请求只与相关网络翻译 api 进行,不会收集、发送或公开用户的任何信息,包括个人的翻译 api 密钥等。
- 请从正规途径获取本 mod。请自行辨别传播的版本。
- 本 mod 仅供学习使用。
- 请保护好个人信息,不要将个人的网络翻译 api 密钥等信息通过手动截图、使用 mod 管理器的共享配置文件等方式进行共享,以免造成不必要的损失。
- 使用本 mod 代表信任本 mod 并同意以上声明。
1. Declaration (Important)
- This mod provides support for some online translation APIs in EtG, allowing in-game text to be translated into languages supported by these APIs.
- The author of this mod does not charge any fees, but using online translation APIs may incur costs, which will be charged by the respective API service providers. Not all translation requests will incur fees; most translation APIs offer a free quota, ranging from 1 million to 5 million characters per month for example. Please refer to the pricing standards of the API you are using. If excessive use of the translation APIs results in charges, the author of this mod is not responsible.
- To use this mod, you need to apply for a service and obtain a key from the translation API provider. Please refer to the provider's documentation for details.
- The mod's network requests are only made to the relevant translation APIs and will not collect, transmit, or disclose any user information, including personal translation API keys.
- Please obtain this mod through legitimate channels. Be cautious of distributed versions.
- This mod is for educational use only.
- Please protect your personal information and avoid sharing your translation API key through manual screenshots, shared configuration files using mod managers, etc., to prevent unnecessary losses.
- By using this mod, you trust it and agree to the above declaration.
2. AutoTranslate 使用方式
- 从 mod 管理器安装 AutoTranslate。
- 第一次安装时,开启该 mod 启动一次游戏并关闭游戏。
- 在mod 管理器的配置中找到 AutoTranslate。
- 在 General 选项卡中选择使用的翻译服务 api。
- 设置RegexForFullTextNeedToTranslate、RegexForEachLineNeedToTranslate和RegexForIgnoredSubstringWithinText。默认为中文设置,如果目标语言是中文不用修改。其他语言自行修改。
- 在下方 OverrideFont 选择需要覆盖的字体。
- 如果你的目标语言不是中文,把 PresetTranslations 置为空,或者用你自定义的PresetTranslations.json。
- 进入选择的 api 选项卡,输入该 api 需要的密钥和其他细节如源语言、目标语言等。翻译 api 需要的必选项和可选项请查阅服务商官方说明。
- 启动游戏。
2. How to Use AutoTranslate
- Install AutoTranslate from the mod manager.
- When installing for the first time, launch the game with this mod enabled, then close the game.
- In the mod manager, find AutoTranslate in the configuration settings.
- In the General tab, select the translation service API you want to use.
- Set RegexForFullTextNeedToTranslation, RegexForEachLineNedToTranslate and RegexForIgnoreDubstringWithinText. The default setting is for Chinese. If the target language is Chinese, there is no need to modify it. For other languages, please modify on your own.
- Select the font you want to override in the OverrideFont below.
- If your target language is not Chinese, set PresetTranslations to empty or use your custom PresetTranslations.json.
- Go to the tab for the selected API, and enter the required key and other details like source language, target language, etc. For required and optional parameters for the translation API, please refer to the official documentation of the API provider.
- Launch the game.
3. 节约翻译额度的方法
包括设置RegexForFullTextNeedToTranslate、RegexForEachLineNeedToTranslate和PresetTranslations都可以显著减少不必要的翻译。见详细说明。
3. Ways to Save Translation Quotas
Setting RegexForFullTextNeedToTranslate, RegexForEachLineNeedToTranslate, and PresetTranslations can significantly reduce unnecessary translations. Please refer to detailed description.
4. AutoTranslate功能详细说明
-
TranslationAPI
选择使用的翻译 API。支持腾讯翻译 api、百度翻译 api和 Microsoft Azure 翻译 api。截止 2025.1.29,三者的免费额度为 Tencent 500万字符/月、Baidu 100万字符/月、Azure 200万字符/月。详见官方说明。 -
RegexForFullTextNeedToTranslate
正则表达式,一个多行文本若匹配为真,则这个多行文本保留以待翻译。用来筛选待翻译的文本以节省翻译额度。 样例RegexForFullTextNeedToTranslate正则表达式:^(?!Enter the Gungeon).*$
-
RegexForEachLineNeedToTranslate
正则表达式,多行文本若存在一行匹配,整个多行文本保留以待翻译。用来筛选待翻译的文本以节省翻译额度。样例RegexForEachLineNeedToTranslate正则表达式(适配中文):^(?![@#])(?=\S)(?!^[\d\p{P}]+$)(?!.*[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]).*$
-
RegexForIgnoredSubstringWithinText
正则表达式,匹配文本中需要忽略的子文本。请使用非捕获组。这通常包括一些要特殊处理的贴图和转义符。样例RegexForIgnoredSubstringWithinText正则表达式(适配中文):(?:\[[^\]]*\])|(?:\{[^}]*\})|(?:\^[\w\d]{9})|(?:[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]+)
-
RequestBatchSize
发送请求的批量数据总大小。若翻译 api 提示单次请求过长,请减小此值。 -
MaxRetryCount
发生错误时的最大重试次数。 -
TranslationCacheCapacity
最大翻译缓存容量。 -
TranslateTextsOfItemTipsMod
翻译 ItemTipsMod 中的文本。 -
PresetTranslations
预设翻译的文件名。使用预设翻译以减少加载时常见文本的翻译请求,留空表示不使用。预设翻译为位于 dll 同目录下的 json 文件。 -
OverrideFont
用来覆盖游戏字体的字体。根据你需要的目标语言选择。 -
FontAssetBundleName
包含自定义字体的 AssetBundle 名称。位于 dll 同目录下。 -
CustomDfFontName
要使用的自定义 df 字体。请把它包含于 FontAssetBundle。 -
CustomTk2dFontName
要使用的自定义 tk2d 字体。请把它包含于 FontAssetBundle。 -
RegexForDfTokenizer
用于 df 生成 token 的正则表达式。token 用于处理文本的自动换行位置。如每个字换行还是单词后换行。参考默认样例填写。建议只修改 Text 相关内容。样例RegexForDfTokenizer正则表达式:(?<StartTag>\[(?<TagName>(color|sprite))\s*(?:\"(?<AttributeValue>[^\"]*)\")?\])|(?<EndTag>\[/\k<TagName>\])|(?<Newline>\r?)|(?<Whitespace>\s+)|(?<Text>[a-zA-Z0-9]+|.)
- StartTag:Tag 起始。
- TagName:Tag 名称。
- AttributeValue:Tag 属性值。
- EndTag:Tag 结束。
- Newline:换行。
- Whitespace:空格。
- Text:一个不可在中间换行的最小文本块。换行只能出现在它的后方。
-
LogRequestedTexts
在日志中显示请求翻译的文本。
4. Detailed Description of AutoTranslate Features
-
TranslationAPI
Select the translation API to use. Supported APIs include Tencent Translation API, Baidu Translation API, and Microsoft Azure Translation API. As of January 29, 2025, the free quotas are: Tencent 5 million characters/month, Baidu 1 million characters/month, Azure 2 million characters/month. Please refer to the official documentation for more details. -
RegexForFullTextNeedToTranslate
A regular expression that matches multiline text. If the expression evaluates to true, the entire multiline text will be preserved for translation. This helps filter out unnecessary translation requests and save tranlation quotas. Example RegexForFullTextNeedToTranslate regex:^(?!Enter the Gungeon).*$
-
RegexForEachLineNeedToTranslate
A regular expression that checks each line in multiline text. If any line matches, the whole multiline text will be preserved for translation. This also helps filter out unnecessary translation requests and save tranlation quotas. Example RegexForEachLineNeedToTranslate regex (fit for Chinese):^(?![@#])(?=\S)(?!^[\d\p{P}]+$)(?!.*[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]).*$
-
RegexForIgnoredSubstringWithinText
A regular expression that matches substrings within text that should be ignored. Please use non-capturing groups. This typically includes elements like special image tags or escape sequences that need custom handling. Example RegexForIgnoredSubstringWithinText regex (fit for Chinese):(?:\[[^\]]*\])|(?:\{[^}]*\})|(?:\^[\w\d]{9})|(?:[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]+)
-
RequestBatchSize
The total size of the batch data for each translation request. If the translation API indicates that a request is too large, reduce this value. -
MaxRetryCount
The maximum number of retry attempts when an error occurs during a translation request. -
TranslationCacheCapacity
The maximum cache size for storing translations. -
TranslateTextsOfItemTipsMod
Translate the text within the ItemTipsMod. -
PresetTranslations
The filename of preset translations. Preset translations reduce translation requests for common texts during game loading. Leave it empty to disable this feature. The preset translations file is a JSON file located in the same directory as the DLL. -
OverrideFont
Font used to override the font of the game. Choose according to the target language you need. -
FontAssetBundleName
The name of the AssetBundle containing custom fonts. Located in the same directory as the DLL. -
CustomDfFontName
The name of the custom DF font to use. Include it within the FontAssetBundle. -
CustomTk2dFontName
The name of the custom tk2d font to use. Include it within the FontAssetBundle. -
RegexForDfTokenizer
A regular expression used to generate tokens for the DF tokenizer. Tokens help control the automatic line breaks for text. For example, whether to break lines after each character or after each word. Refer to the default example and modify mainly the text-related components. Example RegexForDfTokenizer regex:(?<StartTag>\[(?<TagName>(color|sprite))\s*(?:\"(?<AttributeValue>[^\"]*)\")?\])|(?<EndTag>\[/\k<TagName>\])|(?<Newline>\r?)|(?<Whitespace>\s+)|(?<Text>[a-zA-Z0-9]+|.)
- StartTag: The start of a tag.
- TagName: The name of the tag.
- AttributeValue: The value of the tag attribute.
- EndTag: The end of a tag.
- Newline: A newline character.
- Whitespace: Spaces or tabs.
- Text: The smallest text block that cannot break in the middle; line breaks can only occur after it.
-
LogRequestedTexts
Log the text requested for translation.
5. 字体相关
若默认字体不支持所需语言的字符,可以使用自定义字体。详见GitHub页面。
5. Font-related
If the default font does not support the characters required for a specific language, you can use a custom font. For more details, please refer to the GitHub page.