


我必须强调,如果这个mod不是为你设计的,那你就忽略它,那么你的钱包不会因为它损失一分钱。可能有人跳出来说:“什么?居然要花钱?”
我想我作为一个mod创作者,我做了所有我能做的。我查找了网上的翻译api,找了稳定并具有高免费额度的,然后贴心地在文档的声明里标出来;我还在代码里优化了翻译的请求,诸如去重、缓存、预设,并允许用户自己来筛选需要翻译的字符集。
我做这些没有哪怕一分钱的回报,我本可以不做上面的任何一条,这个mod本可以不问世。
众所周知,稳定翻译api不是免费的,由服务提供商收费。当然也有免费的,但是会被阻止IP或要求rechaptcha,如google的免费接口,但这些对于一个实时翻译mod来说太不靠谱了。而你不能指望我自己掏钱来为用户的翻译买单。让用户自己使用他们的免费额度是一个好的选择。
总之,如果一个东西不是为你设计的,你没有理由抱怨它。
I must emphasize that if this mod is not designed for you, then ignore it and your wallet won't lose a penny because of it. Someone maybe jumps out and says, 'What? How dare they charge for use?'
I think as a mod creator, I have done everything I can do. I searched for translation APIs, found stable ones with high free quotas, and thoughtfully marked them in the document's declaration; I also optimized translation requests in the code, such as deduplication, caching, presets, and allowing users to filter the character sets that need to be translated themselves.
I don't get any return on doing these things, I could have avoided doing any of the above, and this mod could not have been released.
As is well known, stable translation APIs are not free, charged by the service provider. Of course, there are also free ones, but they may be blocked by IP or require recaptcha after frequent use, such as Google's free interface, but these are too unreliable for a real-time translation mod. And you can't expect me to pay for users' translations at my own expense. Allowing users to use their own free quotes is a good choice.
In short, if something is not designed for you, you have no reason to complain about it.
包括设置RegexForFullTextNeedToTranslate、RegexForEachLineNeedToTranslate和PresetTranslations都可以显著减少不必要的翻译。见详细说明。
Setting RegexForFullTextNeedToTranslate, RegexForEachLineNeedToTranslate, and PresetTranslations can significantly reduce unnecessary translations. Please refer to detailed description.
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]+|.)
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]+|.)
若默认字体不支持所需语言的字符,可以使用自定义字体。详见GitHub页面。
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.