Tool Ren'Py Ren'py realtime translator Mod[v0.08]

Jul 28, 2025
74
26
Update:
August 17, 2025
Installation:
You need to copy three .rpy files to your game directory.
You need to edit transconfig.rpy to select your target language.
The language codes are those used by Google Translate. Most language codes can be found here:
https://attachments.f95zone.to/2025/08/5145840_sorted_language_lists.txt

Technical Details:
You need access to Google Translate!
The useragentlist.rpy file is used to provide the User-Agent header so you don't get banned by Google for frequent abuse.
While I think the one-line-per-request method is inefficient, I think it could be replaced with a method that translates several lines per second.
The core function is renpy.text.text.Text.update. I replaced it with a hook function so that every text displayed by renpy can be translated.
 
Last edited:
Jul 28, 2025
74
26
update 18-08-2025
learning from other translator mod,translated lines will be stored in a cache json,
which will be a good start for Asynchronous translation,and you don't need to retranslate lines you read already.
And it seems that the delay decreased a bit,due to renpy's predict texts are translated before they are displayed.(You need to wait a while when you first time usingthe mod)
I improved the code protection as well.
Only realtimetrans.rpy is updated.
 
  • Like
Reactions: CAT0X0
Jul 28, 2025
74
26
update:20-08-2025
Key technical updates:
1. Implemented a timed multi-line translation request, triggered when new text is rendered. It's set to translate text within 1 second. So, if you don't see the translated text, click any button, and it should refresh the interface. I'm considering adding a refresh button or a true timed request. Currently, the timing relies on the Text.update function.
2. Added two hash sets to store the translated text before and after, reducing lookup time and preventing repeated translations.
3. Fluency has been significantly improved. This is because translation isn't completely real-time now. In Previous version, translation requests blocked rendering. Now, the Text object re-renders after retrieving the translated text.
Still Only realtimetrans.rpy is updated.
 
  • Like
Reactions: CAT0X0
Jul 28, 2025
74
26
update:21-08-2025
1-using config.periodic_callback ,i make the translate request a real periodic function.You can edit the time_interval in transconfig.rpy now.
2-the mod can adjust Text size now,you can edit FONT_SIZE_ADJUSTMENT_CONFIG in transconfig.rpy .The default config should only adjust the translated texts which are more than two times longer than the originals.

I am planning on fonts auto choose in next update.
 
Last edited:
  • Like
Reactions: CAT0X0
Jul 28, 2025
74
26
update:22-08-25
using Text.apply_custom_tags,i make it possible for you to choose your preferred fonts for translated text.
BUT there are still lots to do,as no font would support all unicodes,the mod should be able to apply different font styles for one text, As there are layout problems when simply applying {font=font1}{font=font2}text{\font}long text{\font},
i am trying to use Text.tokenize to make tokens for different fonts .It should be include in next update.

Today's update include transconfig.rpy which you can set the font you want to use now,and realtimetrans.rpy.
Besides,i would recommend
a great font covered most of the unicode except colored emojis.
 
Jul 28, 2025
74
26
update:27-08-2025
1. Rewrote the add function in Renpy's font_group to prioritize fonts added later. This ensures that the original developer's font is used when the translated text could be displayed.
2. Hook TextSegment.subsegment to read the font before running and add it to the font_group. This avoids issues with using fonts in text labels, and also manages text size changes in this section.
3. The default font currently added to the font_group is TRANSFONT from transconfig.rpy. You can change it to your preferred font. Also added Renpy's built-in twemoji font to support color emojis.
 
  • Like
Reactions: CAT0X0
Jul 28, 2025
74
26
update:29-08-2025
LLM translation is now available!

1. Add a new configuration file, llmtransconfig.rpy, to set your translation method. Currently, only OpenRouter and Google are supported. You'll need to enter your own OPENROUTER_API_KEY; otherwise, it won't work. Also, select the model you want to use; models with chain of thought are not currently supported. TRANSLATION_PROMPT is also included in this file; you can modify it if the default prompt isn't sufficient.

2. Add the transform_with_openrouter function to the realtimetrans.rpy file to support LLM translation. Translated text will be appended to the post data, improving model performance. Set the temperature to 0.1, as the translated text needs to be recovered by the translated HTML structure.
3. I strongly recommend editing the Time_Interval in transconfig.rpy to meet the rate limits of your LLM API provider (for OpenRouter, this should be bigger than 3 if you're using the free model).
4- This is not an advertisement for OpenRouter, I just chose the free LLM API provider for testing, the general OpenAI style API will be supported in the next update.
 
Jul 28, 2025
74
26
update:03-09-2025

1. Switching from Only OpenReuter to support all OpenAI-style API translations.
Parameters in llmtransconfig have been modified, allowing manual adjustment of parameters such as MAX_TOKENS, TIME_OUT, BASE_URL, MODEL, and APPENDED_LINES.
2. Adding a proxy switch and proxy parameters to support users who prefer using proxies.
3. Testing with some models with Chain of Thought revealed that they functioned properly under low temperature settings.
4. Detaching all translation functions from the main thread using renpy.invoke_in_thread and renpy.invoke_in_main_thread to avoid high latency in receiving responses when using LLM translation, which could block game progress. However, please note that renpy.invoke_in_main_thread does not exist in old renpy versions .
5.Added a retry mechanism; if the translated text is same to the original text, one retry will be performed.
 
Last edited:
Jul 28, 2025
74
26
Further aim is trying to make the mod work in android version renpy games and add a screen in the game start or an option in the preferences to avoid manually modify