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.
| Date uploaded | a year ago |
| Version | 1.0.11 |
| Download link | KLEIROF-Auto_Translate-1.0.11.zip |
| Downloads | 211 |
| Dependency string | KLEIROF-Auto_Translate-1.0.11 |
This mod requires the following mods to function
MtG_API-Mod_the_Gungeon_API
Adds the good parts of Mod the Gungeon to BepInEx.
Preferred version: 1.9.2Alexandria-Alexandria
A combination of old and new APIs, and new tools for the convenience of modders.
Preferred version: 0.5.3README
自动翻译 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 learning 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。
- 在 General 选项卡中,设置RegexForFullTextNeedToTranslate、RegexForEachLineNeedToTranslate和RegexForIgnoredSubstringWithinText。默认为中文设置,如果目标语言是中文不用修改。其他语言自行修改。
- 在 General 选项卡中,如果你的目标语言不是中文,把 PresetTranslations 置为空,或者用你自定义的PresetTranslations.json。
- 在 Font 选项卡中 OverrideFont 选择需要覆盖的字体。若目标语言是为中文,设为Chinese或Custom(推荐)。其他语言自行设置。
- 进入选择的 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.
- In the General tab, 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 set on your own.
- In the General tab, If your target language is not Chinese, set PresetTranslations to empty or use your custom PresetTranslations.json.
- In the Font tab, Select the font you want to override in the OverrideFont below. If the target language is Chinese, set it as Chinese or Custom (recommended). For other languages, please modify on your own.
- 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功能详细说明
总体 General
-
TranslationAPI
选择使用的翻译 API。支持腾讯翻译 api、百度翻译 api和 Microsoft Azure 翻译 api。截止 2025.1.29,三者的免费额度为 Tencent 500万字符/月、Baidu 100万字符/月、Azure 200万字符/月。详见官方说明。 -
ToggleTranslationKeyBinding
启用或关闭翻译的按键。 -
RegexForFullTextNeedToTranslate
正则表达式,一个多行文本若匹配为真,则这个多行文本保留以待翻译。用来筛选待翻译的文本以节省翻译额度。 样例RegexForFullTextNeedToTranslate正则表达式:^(?!Enter the Gungeon).*$ -
RegexForEachLineNeedToTranslate
正则表达式,多行文本若存在一行匹配,整个多行文本保留以待翻译。用来筛选待翻译的文本以节省翻译额度。样例RegexForEachLineNeedToTranslate正则表达式(适配中文):^(?![@#])(?=\S)(?!^[\d\p{P}]+$)(?!.*[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]).*$ -
RegexForIgnoredSubstringWithinText
正则表达式,匹配文本中需要忽略的子文本。请使用非捕获组。这通常包括一些要特殊处理的贴图和转义符。样例RegexForIgnoredSubstringWithinText正则表达式(适配中文):(?:\[color\s+[^\]]+\])|(?:\[sprite\s+[^\]]+\])|(?:\[/color\])|(?:\{[^}]*\})|(?:\^[\w\d]{9})|(?:[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]+)|(?:<color=[^>]+>)|(?:</color>)|(?:<|>) -
RequestBatchSize
发送请求的批量数据总大小。若翻译 api 提示单次请求过长,请减小此值。 -
MaxRetryCount
发生错误时的最大重试次数。 -
TranslationCacheCapacity
最大翻译缓存容量。 -
PresetTranslations
预设翻译的文件名。使用预设翻译以减少加载时常见文本的翻译请求,留空表示不使用。预设翻译为位于 dll 同目录下的 json 文件。 -
LogRequestedTexts
在日志中显示请求翻译的文本。
字体 Font
-
OverrideFont
用来覆盖游戏字体的字体。根据你需要的目标语言选择。 -
FontAssetBundleName
包含自定义字体的 AssetBundle 名称。位于 dll 同目录下。 -
CustomDfFontName
要使用的自定义 df 字体。请把它包含于 FontAssetBundle。 -
CustomTk2dFontName
要使用的自定义 tk2d 字体。请把它包含于 FontAssetBundle。 -
RegexForDfTokenizer
用于 df 生成 token 的正则表达式。token 用于处理文本的自动换行位置。如每个字换行还是单词后换行。参考默认样例填写。建议只修改 Text 相关内容。样例RegexForDfTokenizer正则表达式:(?<StartTag>\[(?<StartTagName>(color|sprite))\s*(?<AttributeValue>[^\]\s]+)?\])|(?<EndTag>\[\/(?<EndTagName>color|sprite)\])|(?<Newline>\r?)|(?<Whitespace>\s+)|(?<Text>[a-zA-Z0-9]+|.)- StartTag:Tag 起始。
- TagName:Tag 名称。
- AttributeValue:Tag 属性值。
- EndTag:Tag 结束。
- Newline:换行。
- Whitespace:空格。
- Text:一个不可在中间换行的最小文本块。换行只能出现在它的后方。
-
DfTextScaleExpandThreshold
低于这个值的 Df TextScale 会被扩大。为负表示不生效。 -
DfTextScaleExpandToValue
低于门槛的 Df TextScale 被扩大到多少。
请求字符数 Requested Character Count
-
ShowRequestedCharacterCount
显示已翻译字符数。 -
RequestedCharacterCountAlertThreshold
已请求翻译字符数警报阈值。当翻译请求即将超出时,会暂停翻译。为零表示不设阈值。 -
ToggleRequestedCharacterCountKeyBinding
开启或关闭已翻译字符数的显示的按键。 -
CountLabelAnchor
用空格或逗号分隔的一个二维向量,决定计数标签相对于父级的锚点位置。左上角为0 0,右下角是1 1。 -
CountLabelPivot
用空格或逗号分隔的一个二维向量,定义计数标签的定位基准点。左上角为0 0,右下角是1 1。
兼容 Compatibility
-
TranslateTextsOfItemTipsMod
翻译 ItemTipsMod 中的文本。 -
RegexForItemTipsModTokenizer
用于 ItemTipsMod 生成 token 的正则表达式。token 用于处理文本的自动换行位置。如每个字换行还是单词后换行。样例 RegexForItemTipsModTokenizer 正则表达式:(?:<color=[^>]+?>|</color>|[a-zA-Z0-9]+|\s+|.)
4. Detailed Description of AutoTranslate Features
General
-
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. -
ToggleTranslationKeyBinding
The key binding of toggling translation. -
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):(?:\[color\s+[^\]]+\])|(?:\[sprite\s+[^\]]+\])|(?:\[/color\])|(?:\{[^}]*\})|(?:\^[\w\d]{9})|(?:[\u4e00-\u9fa5\u3000-\u303F\uFF00-\uFFEF]+)|(?:<color=[^>]+>)|(?:</color>)|(?:<|>) -
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. -
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. -
LogRequestedTexts
Log the text requested for translation.
Font
-
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>\[(?<StartTagName>(color|sprite))\s*(?<AttributeValue>[^\]\s]+)?\])|(?<EndTag>\[\/(?<EndTagName>color|sprite)\])|(?<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.
-
DfTextScaleExpandThreshold
Df TextScale below this value will be expanded. Negative indicates non effectiveness. -
DfTextScaleExpandToValue
How much is the Df TextScale below the threshold expanded to.
Requested Character Count
-
ShowRequestedCharacterCount
Show requested character count. -
RequestedCharacterCountAlertThreshold
The alert threshold of the count of characters requested for translation. When this count is about to exceed, translation will be paused. -
ToggleRequestedCharacterCountKeyBinding
The key binding of toggling the display of requested character count. -
CountLabelAnchor
A two-dimensional vector separated by spaces or commas, which determines where the count label is anchored relative to its parent. The top left corner is 0 0, and the bottom right corner is 1 1. -
CountLabelPivot
A two-dimensional vector separated by spaces or commas, which defines the pivot point of the count label for positioning. The top left corner is 0 0, and the bottom right corner is 1 1.
Compatibility
-
TranslateTextsOfItemTipsMod
Translate the text within the ItemTipsMod. -
RegexForItemTipsModTokenizer
A regular expression used for generating tokens from ItemTipsMod. Token is used to handle the automatic line break position of text. Whether to wrap each word or to wrap after each word. Example RegexForItemTipsModTokenizer regex:(?:<color=[^>]+?>|</color>|[a-zA-Z0-9]+|\s+|.)
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.
CHANGELOG
更新日志 Changelog
- 1.2.15:优化。
- 1.2.14:对TextBoxManager进行合法性检查。
- 1.2.13:优化。
- 1.2.12:优化以减少CPU压力。
- 1.2.11:修复游戏暂停导致翻译时间获取异常的问题。
- 1.2.10:增加频率限制功能,防止同一对象重复发送过多翻译请求。
- 1.2.9:修复抛出异常导致翻译终止的问题。
- 1.2.8:修复文本块分块翻译后丢失的问题。优化以减少GC。
- 1.2.7:修复dfLabel的文本框大小和位置异常问题。
- 1.2.6:修复第一次进入boss房的卡顿问题。修复boss卡片文本显示异常问题。修复tk2dTextMesh的文本框大小异常问题。
- 1.2.5:兼容Modular和Planetside Of Gunymede的自定义贴图。
- 1.2.4:移除弃用的dfDynamicFont和包含自定义字体的AssetBundle,以避免dfDynamicFont造成的游戏崩溃。
- 1.2.3:提醒:使用dfDynamicFont会造成游戏崩溃,请使用dfFont代替。
- 1.2.2:优化。
- 1.2.1:分离翻译缓存和全文本缓存。
- 1.2.0:修复一些情况下的崩溃问题。增加DfLabel、DfButton、Tk2dTextMesh的翻译开关选项。
- 1.1.6:加强TextObject的查找安全性。
- 1.1.5:优化TextObject的哈希获取逻辑。
- 1.1.4:优化以减少GC压力。
- 1.1.3:优化以减少GC压力。对缓存的对象进行安全检查。修复加载场景字体模糊问题。
- 1.1.2:修复在中文语言下与Expand the Gungeon的兼容性问题。
- 1.1.1:修复分词器导致游戏卡死的问题。
- 1.1.0:为中文提供默认的字符串处理的实现来代替正则表达式,大大减少GC压力。
- 1.0.20:为LLM提供单条并行翻译的支持。
- 1.0.19:优化LLM的Positioned格式的解析。添加保存和加载缓存翻译的功能。添加在关闭游戏是自动保存缓存翻译的功能。
- 1.0.18:为LLM提供更多数据格式的支持。
- 1.0.17:为本地部署的LLM提供支持。
- 1.0.16:不开启TranslateTextsOfItemTipsMod也覆盖ItemTips的显示属性。
- 1.0.15:更新RegexForIgnoredSubstringWithinText的默认值。为大模型增加额外的参数选项。
- 1.0.14:优化字体显示。增加ItemTips模组字体大小、显示宽度、行高、显示位置的修改选项。
- 1.0.13:优化。
- 1.0.12:修复部分文本不被翻译的问题。修复某些小贴图不显示的问题。进行一些优化。
- 1.0.11:修复部分标签与文本大小不匹配的问题。修复NoBrain模组的标签位置有异常偏移的问题。修复有时候不完全翻译的问题。
- 1.0.10:增加对象池以优化。
- 1.0.9:增加对大模型的支持。进行一些优化。
- 1.0.8:修复警报时标签不显示的问题。更好的RegexForIgnoredSubstringWithinText。改变已经请求翻译的字符数标签位置,并允许自定义位置。将配置文件分条目。
- 1.0.7:修复追加的文本不被翻译的问题。兼容NoBrain。删除多余的配置选项。增加一个标签显示已经请求翻译的字符数。增加请求翻译到达界限时发出警报并暂停翻译的功能。增加请求字符数标签开启/关闭快捷键。增加翻译开启/关闭快捷键。
- 1.0.6:修复过长文本导致翻译队列阻塞的问题。修复特殊标记被翻译或不被处理的问题。增加功能,可以自定义一些标签的高度防止超出范围。增加可以放大过小的文本的功能。修复一些文本不被翻译的问题。修复ItemTipsMod文本先被切割成多行再翻译造成不连贯的问题。修复动态字体字符宽度计算的问题。增加一种中文自定义点阵字体。使用动态自定义字体可以解决某些mod文本内嵌贴图不显示的问题。
- 1.0.5:增加对象复用以优化性能。
- 1.0.4:没有更新。
- 1.0.3:允许用户查看那些文本被请求翻译。在配置里面勾选LogRequestedTexts以生效。
- 1.0.2:更新说明文档。修复RequestBatchSize未生效的问题。优化初始化逻辑。
- 1.0.1:更新说明文档。
- 1.0.0:发布。
- 1.2.15: Optimized.
- 1.2.14: Performed validity checks on TextBoxManager.
- 1.2.13: Optimized.
- 1.2.12: Optimized to reduce CPU pressure.
- 1.2.11: Fixed the issue of wrong translation time acquisition caused by game pause.
- 1.2.10: Added the feature of rate limiting to prevent a same object from sending too many translation requests.
- 1.2.9: Fixed the issue of throwing exceptions causing translation termination.
- 1.2.8: Fixed the issue of text chunk loss after chunked translation. Optimized to reduce GC.
- 1.2.7: Fixed the issue of wrong size and position of the text box of dfLabel.
- 1.2.6: Fixed the lag issue when entering the boss room for the first time. Fixed the issue of wrong display of boss card text. Fixed the issue of wrong text box size of tk2dTextMesh.
- 1.2.5: Compatible with custom sprites of Modular and Planetside Of Gunymede.
- 1.2.4: Removed deprecated dfDynamicFont and AssetBundle containing customized fonts to avoid game crashes caused by dfDynamicFont.
- 1.2.3: Reminder: Using dfDynamicFont may cause the game to crash, please use dfFont instead.
- 1.2.2: Optimized.
- 1.2.1: Separated translation cache and full-text cache.
- 1.2.0: Fixed crash issues in some cases. Added translation switch options for DfLabel, DfButton, and Tk2dTextMesh.
- 1.1.6: Enhanced the robustness of TextObject lookup.
- 1.1.5: Optimized the hash acquisition logic of TextObject.
- 1.1.4: Optimized to reduce GC pressure.
- 1.1.3: Optimized to reduce GC pressure. Performed safety checks on cached objects. Fixed the issue of blurry font in the loading scene.
- 1.1.2: Fixed the compatibility issue with Expand the Gungeon in Chinese language.
- 1.1.1: Fixed the issue where the tokenizer could cause the game to freeze.
- 1.1.0: Provided a default string processing implementation for Chinese to replace regular expressions, significantly reducing GC pressure.
- 1.0.20: Provided support for single parallel translation for LLM.
- 1.0.19: Optimized the parsing of LLM's Positioned format. Added the feature of saving and loading cached translations. Add the feature of automatically saving cached translations when quiting the game.
- 1.0.18: Provided more support for data formats for LLM.
- 1.0.17: Provided support for LLM deployed locally.
- 1.0.16: The display attributes of ItemTips are overridden even when TranslateTextsOfItemTipsMod is not enabled.
- 1.0.15: Updated the default value of RegexForIgnoredSubstringWithinText. Added an extra parameter option for the large model.
- 1.0.14: Optimized font display. Added options to adjust the font size, display width, line height, and position of ItemTips Mod.
- 1.0.13: Optimized.
- 1.0.12: Fixed the issue of some texts not being translated. Fixed the issue where some sprites does not display. Made some optimizations.
- 1.0.11: Fixed the issue where some labels did not match the size of the text. Fixed the issue of abnormal offset of the label position in the NoBrain mod. Fixed the issue of incomplete translation at times.
- 1.0.10: Added object pool to optimize.
- 1.0.9: Added support for large models. Made some optimizations.
- 1.0.8: Fixed the issue of the label not displaying when alerts are triggered. Better RegexForIgnoredSubstringWithinText. Changed the position of the label displaying the number of characters having been requested for translation and allowed customization of the position. Breaked down the configurations into entries.
- 1.0.7: Fixed the issue of text not being translated when appending the text. Compatible with NoBrain. Removed unnecessary configuration options. Added a label to display the number of characters that have been requested for translation. Added the function of issuing an alert and pausing translation when the requested translation reaches a threshold. Added the key binding of toggling the display of requested character count. Added the key binding of toggling translation.
- 1.0.6: Fixed the issue of translation queue blocking caused by excessively long text. Fixed issues where special tags are translated or not processed. Added the feature to customize the height of some labels to prevent exceeding the range. Added the feature to enlarge text that is too small. Fixed some text not being translated issues. Fixed the issue where the ItemTipsMod text was first cut into multiple lines and then translated, causing inconsistency. Fixed the issue of calculating the width of dynamic font characters. Added a custom Chinese dot matrix font. Using dynamic custom fonts can solve the problem of some mod text embedding sprites not displaying.
- 1.0.5: Increase object reuse to optimize performance.
- 1.0.4: Nothing new.
- 1.0.3: Allowed users to view which texts have been requested for translation. Check LogRequestdTexts in the configuration to take effect.
- 1.0.2: Update the description documentation. Fixed the issue of RequestBatchSize not taking effect. Optimized initialization logic.
- 1.0.1: Update the description documentation.
- 1.0.0: Released.