XUnity.AutoLLMTranslator 是一个用于 XUnity.AutoTranslator 框架的插件,它通过大型语言模型(LLM)实现游戏文本翻译。
XUnity.AutoLLMTranslator is a plugin for the XUnity.AutoTranslator framework that enables game text translation using large language models (LLM).
该插件提供了高性能、可定制的翻译功能。
This plugin offers high-performance and customizable translation features.
XUnity.AutoLLMTranslator.dll 文件复制到的插件文件夹中:XUnity.AutoLLMTranslator.dll file to the plugin folder:
Config.ini 文件以使用 "AutoLLMTranslate" 端点。注意在不同基础插件中Config.ini文件的名字和路径都可能不同。
Configure the Config.ini file to use the "AutoLLMTranslate" endpoint. Note that the name and path of the Config.ini file may vary in different environments.在 Config.ini 文件中修改以下配置:
Modify the following configuration in the Config.ini file:
[Service]
Endpoint=AutoLLMTranslate
此外,你需要正确的配置:
Additionally, you need to configure correctly:
Language=zh-cn
FromLanguage=en
[Service]
Endpoint=AutoLLMTranslate
[General]
Language=zh_cn
FromLanguage=en
最小配置minimum configuration:
[AutoLLM]
APIKey= <OPTION>
Model=qwen3:8b
URL=http://localhost:11434/v1
完整配置complete configuration:
[AutoLLM]
APIKey= <OPTION>
Model=qwen-turbo
URL=https://dashscope.aliyuncs.com/compatible-mode/v1
Requirement=/no_think
Terminology=
GameName=DeathMustDie
GameDesc=一个刷装备打怪的游戏、暗黑破坏神的风格和元素
ModelParams={"temperature":0.1}
HalfWidth=True
MaxWordCount=500
ParallelCount=3
Interval=200
MaxRetry=10
LogLevel=Error
Log2File=False
配置说明:
Configuration description:
Model:用于翻译的模型。 The model used for translation.URL:LLM 服务器的 URL,一般以/v1结尾。也可以是/chat/completions的完整路径。 URL of the LLM server, usually ending with /v1. It can also be the full path to /chat/completions.APIKey:LLM 服务器的 API 密钥。如果使用本地模型,可以留空。你可以使用;分割多个key来实现负载均衡。 API key for the LLM server. If using a local model, this can be left blank. You can use ; to separate multiple keys for load balancing.Requirement:额外的翻译需求或指令,例如:使用莎士比亚的风格进行翻译。 Additional translation requirements or instructions, e.g., translating in Shakespearean style.Terminology:术语表,使用|隔开不同术语,使用==连接原文和翻译。例如:Lorien==罗林|Skadi==斯卡蒂 。Terminology list, with different terms separated by | and original text and translation connected by ==,e.g.,Lorien==罗林|Skadi==斯卡蒂.GameName: 游戏名字 Name of the gameGameDesc:游戏介绍,用于帮助AI进行更准确的翻译,可以对游戏的玩法/类型/风格进行描述。 Game description to help the AI perform more accurate translations. It can describe gameplay, type, or style.ModelParams: 模型参数定制,使用json格式书写,会直接传递给模型api。例如:{"temperature":0.1}MaxWordCount:每批翻译的最大单词数,适当的单词可以减少并发数量从而提高翻译速度。 Maximum number of words per batch translation. Proper word count can reduce concurrency and improve translation speed.ParallelCount:并行翻译任务的最大数量,一般由LLM的提供商决定。 Maximum number of parallel translation tasks, usually determined by the LLM provider.Interval:轮询间隔(毫秒),每次翻译的间隔,在间隔中系统会尽可能的合并翻译内容,以便提高翻译速度减少并发,但太长会导致响应不够及时。 Polling interval (in milliseconds). During this interval, the system will try to merge translation content to improve speed and reduce concurrency. However, too long an interval may lead to delayed responses.HalfWidth:是否将全角字符转换为半角,在字体无法显示全角符号的时候使用这个。 Whether to convert full-width characters to half-width. Use this when fonts cannot display full-width symbols.MaxRetry:失败翻译的最大重试次数,一般不动,如果大模型失败率太高,可以尝试提高。 Maximum retry attempts for failed translations. Generally, this should not be changed, but if the large model has a high failure rate, you can try increasing it.DisableSpamChecks: 禁用垃圾检查,默认False。 Disable spam checks, False by default.LogLevel:日志等级,Error/Warning/Info/Debug。 Log level: Error/Warning/Info/Debug.Log2File:是否将日志写入文件。 Whether to write logs to a file.除了使用LLM远程服务以外,也可以使用类似ollama的本地服务,
In addition to using LLM remote services, you can also use local services like ollama,
只需要填写Model和URL即可
Just fill in the Model and URL
在选择大模型时往往需要同时权衡速度和质量,经过我的测试,有以下建议:
When choosing a large model, you often need to balance speed and quality. Based on my tests, I have the following recommendations:
本项目根据包含的许可证文件中规定的条款授权。
This project is licensed under the terms specified in the included license file.
该插件基于 XUnity.AutoTranslator 开发。
This plugin is developed based on XUnity.AutoTranslator.
同时也使用了FuzzyString(https://github.com/kdjones/fuzzystring)来实现文本搜索。
It also uses FuzzyString (https://github.com/kdjones/fuzzystring) for text search.
感谢他们的付出
Thanks to them for their contributions.
C#
100.0%
XUnity.AutoLLMTranslator 是一个用于 XUnity.AutoTranslator 框架的插件,它通过大型语言模型(LLM)实现游戏文本翻译。
XUnity.AutoLLMTranslator is a plugin for the XUnity.AutoTranslator framework that enables game text translation using large language models (LLM).
该插件提供了高性能、可定制的翻译功能。
This plugin offers high-performance and customizable translation features.
XUnity.AutoLLMTranslator.dll 文件复制到的插件文件夹中:XUnity.AutoLLMTranslator.dll file to the plugin folder:
Config.ini 文件以使用 "AutoLLMTranslate" 端点。注意在不同基础插件中Config.ini文件的名字和路径都可能不同。
Configure the Config.ini file to use the "AutoLLMTranslate" endpoint. Note that the name and path of the Config.ini file may vary in different environments.在 Config.ini 文件中修改以下配置:
Modify the following configuration in the Config.ini file:
[Service]
Endpoint=AutoLLMTranslate
此外,你需要正确的配置:
Additionally, you need to configure correctly:
Language=zh-cn
FromLanguage=en
[Service]
Endpoint=AutoLLMTranslate
[General]
Language=zh_cn
FromLanguage=en
最小配置minimum configuration:
[AutoLLM]
APIKey= <OPTION>
Model=qwen3:8b
URL=http://localhost:11434/v1
完整配置complete configuration:
[AutoLLM]
APIKey= <OPTION>
Model=qwen-turbo
URL=https://dashscope.aliyuncs.com/compatible-mode/v1
Requirement=/no_think
Terminology=
GameName=DeathMustDie
GameDesc=一个刷装备打怪的游戏、暗黑破坏神的风格和元素
ModelParams={"temperature":0.1}
HalfWidth=True
MaxWordCount=500
ParallelCount=3
Interval=200
MaxRetry=10
LogLevel=Error
Log2File=False
配置说明:
Configuration description:
Model:用于翻译的模型。 The model used for translation.URL:LLM 服务器的 URL,一般以/v1结尾。也可以是/chat/completions的完整路径。 URL of the LLM server, usually ending with /v1. It can also be the full path to /chat/completions.APIKey:LLM 服务器的 API 密钥。如果使用本地模型,可以留空。你可以使用;分割多个key来实现负载均衡。 API key for the LLM server. If using a local model, this can be left blank. You can use ; to separate multiple keys for load balancing.Requirement:额外的翻译需求或指令,例如:使用莎士比亚的风格进行翻译。 Additional translation requirements or instructions, e.g., translating in Shakespearean style.Terminology:术语表,使用|隔开不同术语,使用==连接原文和翻译。例如:Lorien==罗林|Skadi==斯卡蒂 。Terminology list, with different terms separated by | and original text and translation connected by ==,e.g.,Lorien==罗林|Skadi==斯卡蒂.GameName: 游戏名字 Name of the gameGameDesc:游戏介绍,用于帮助AI进行更准确的翻译,可以对游戏的玩法/类型/风格进行描述。 Game description to help the AI perform more accurate translations. It can describe gameplay, type, or style.ModelParams: 模型参数定制,使用json格式书写,会直接传递给模型api。例如:{"temperature":0.1}MaxWordCount:每批翻译的最大单词数,适当的单词可以减少并发数量从而提高翻译速度。 Maximum number of words per batch translation. Proper word count can reduce concurrency and improve translation speed.ParallelCount:并行翻译任务的最大数量,一般由LLM的提供商决定。 Maximum number of parallel translation tasks, usually determined by the LLM provider.Interval:轮询间隔(毫秒),每次翻译的间隔,在间隔中系统会尽可能的合并翻译内容,以便提高翻译速度减少并发,但太长会导致响应不够及时。 Polling interval (in milliseconds). During this interval, the system will try to merge translation content to improve speed and reduce concurrency. However, too long an interval may lead to delayed responses.HalfWidth:是否将全角字符转换为半角,在字体无法显示全角符号的时候使用这个。 Whether to convert full-width characters to half-width. Use this when fonts cannot display full-width symbols.MaxRetry:失败翻译的最大重试次数,一般不动,如果大模型失败率太高,可以尝试提高。 Maximum retry attempts for failed translations. Generally, this should not be changed, but if the large model has a high failure rate, you can try increasing it.DisableSpamChecks: 禁用垃圾检查,默认False。 Disable spam checks, False by default.LogLevel:日志等级,Error/Warning/Info/Debug。 Log level: Error/Warning/Info/Debug.Log2File:是否将日志写入文件。 Whether to write logs to a file.除了使用LLM远程服务以外,也可以使用类似ollama的本地服务,
In addition to using LLM remote services, you can also use local services like ollama,
只需要填写Model和URL即可
Just fill in the Model and URL
在选择大模型时往往需要同时权衡速度和质量,经过我的测试,有以下建议:
When choosing a large model, you often need to balance speed and quality. Based on my tests, I have the following recommendations:
本项目根据包含的许可证文件中规定的条款授权。
This project is licensed under the terms specified in the included license file.
该插件基于 XUnity.AutoTranslator 开发。
This plugin is developed based on XUnity.AutoTranslator.
同时也使用了FuzzyString(https://github.com/kdjones/fuzzystring)来实现文本搜索。
It also uses FuzzyString (https://github.com/kdjones/fuzzystring) for text search.
感谢他们的付出
Thanks to them for their contributions.
C#
100.0%