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

Jul 28, 2025
161
57
28
Hello,
Thank you very much for your work.
What else do we need to do besides copying the files you specified to the game folder?
Here is how you should edit the transconfig.rpy
I will explain line by line
init -999 python:
global ENABLE_TRANSLATION
ENABLE_TRANSLATION =True#The translator switch
global TARGET_LANGUAGE
TARGET_LANGUAGE = "de"#change it to your target language ISO language code
global FONT_SIZE_ADJUSTMENT_CONFIG
FONT_SIZE_ADJUSTMENT_CONFIG = {
'enabled': True,#If you want to use translated text size adjust
'min_scale': 0.7,#min size adjust ratio
'max_scale': 1.2,#max size adjust ratio
'length_threshold': 2,
#Translated text length trigerrs the size adjust.2 means it should more than twice longer than the original
}
global time_interval
time_interval=3
#time interval of the translate request. for google 1 is fine for llm you should refer to your api provider for rate limit
global TRANS_FONT
TRANS_FONT="GoNotoCurrent-Regular.ttf"
#The default fonr. for translation you can replace it with any other fonts support your target language
 
Last edited:
Jul 28, 2025
161
57
28
Here is how you should edit llmtransconfig.rpy
Still line by line.
init python:
global TRANSLATION_SERVICE
global API_KEY
global BASE_URL
global MODEL
TRANSLATION_SERVICE = "LLM" # "google" or "LLM"
API_KEY ="Your-API-Key-Here" #Ask your llm api provider for api key
MODEL = "meta-llama/llama-3.3-8b-instruct:free" # choose The model allows nsfw content
BASE_URL = " " #please refer to your model provider python api for the correct URL,model and api-key,default is for openrouter.ai
global MAX_TOKENS
global TEMPERATURE
global TIMEOUT
global PROXIES
global PROXIES_ENABLED
MAX_TOKENS = 8000 #max tokens one request
TEMPERATURE = 0.05
TIMEOUT = 60
global APPENDED_LINES
APPENDED_LINES = 50 #Number of previously translated lines to append as context
PROXIES = {}
PROXIES_ENABLED = False #default to False
global TRANSLATION_PROMPT#The default language to translate is English,You can modify the prompt to change the source language if needed.
TRANSLATION_PROMPT = r"""You are a professional game localization expert. Please translate the following renpy game text from English to {target_lang}.
Translation requirements:
1. Maintain game terminology consistency
2. Preserve all HTML tags, format codes and special marks (such as {{color=#ff000}}red text{{/color}})
3. Special attention: The text may contain <code id="...">...</code> tags. The content inside these tags must not be changed under any circumstances and must be preserved as is.
4. Maintain the natural fluency of game dialogue
5. Adapt to the personality characteristics of game characters
6. Preserve all programming-related symbols (such as %variable%, [option], etc.)

Previously translated texts for reference:
{context}

Please translate the following content:"""
 

reitzh

Newbie
Feb 25, 2023
24
8
79
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


The label before_main_menu is defined twice, at File "game/realtimetrans.rpy", line 189:
label before_main_menu:
and File "script.rpyc", line 222:



Ren'Py Version: Ren'Py 7.6.3.23091805
Sat Sep 6 09:19:49 2025


again??
 
Jul 28, 2025
161
57
28
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


The label before_main_menu is defined twice, at File "game/realtimetrans.rpy", line 189:
label before_main_menu:
and File "script.rpyc", line 222:



Ren'Py Version: Ren'Py 7.6.3.23091805
Sat Sep 6 09:19:49 2025


again??
This error occurred because my custom label name before_main_menl is same with the game's label name.Change the label name will fix the problem.I will change the label name to another name to avoid repeat in next update.
 

trans1

Newbie
Jan 24, 2023
25
0
124
Hello, I have the problem that the translated text is always cut off when it is longer than the original text.

EN.PNG DE.PNG
 

reitzh

Newbie
Feb 25, 2023
24
8
79
This error occurred because my custom label name before_main_menl is same with the game's label name.Change the label name will fix the problem.I will change the label name to another name to avoid repeat in next update.
So how can I change the tag name?
 

reitzh

Newbie
Feb 25, 2023
24
8
79
Sorry.it seems that the problem is more complicated than changing the label name as before_main_menu is a certain label in Ren'py.Try to use this file.New label should run after the existing label.
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/realtimetrans (1).rpy", line 413: expected ':' not found.
init python after:
^

Ren'Py Version: Ren'Py 7.6.3.23091805
Sat Sep 6 15:58:51 2025
 
Jul 28, 2025
161
57
28
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/realtimetrans (1).rpy", line 413: expected ':' not found.
init python after:
^

Ren'Py Version: Ren'Py 7.6.3.23091805
Sat Sep 6 15:58:51 2025
Sorry for all the bugs.This should work, i tested it in Renpy 7.5.2
 

cemo45

Newbie
May 29, 2018
17
1
126
Dude, I did everything you said. The game starts and the translation is done, but after 3-4 scenes it stops. When I exit the game and enter it again, it doesn't translate at all.
 
Jul 28, 2025
161
57
28
Dude, I did everything you said. The game starts and the translation is done, but after 3-4 scenes it stops. When I exit the game and enter it again, it doesn't translate at all.
Are you using google or llm?
If you are using llm ,this might because of your api rate limit.
If you are using google,i need more details.
 

cemo45

Newbie
May 29, 2018
17
1
126
I'm using LLM. I think the API KEY doesn't allow for a certain translation because it's paid?
 
Jul 28, 2025
161
57
28
I'm using LLM. I think the API KEY doesn't allow for a certain translation because it's paid?
I think you should ask your llm api provider instead of me as i know nothing about the api you use.
Based on your description, my guess is that your time_interval is set too low that you hit the rate limit of the api.
 
Jul 28, 2025
161
57
28
Hello, I have the problem that the translated text is always cut off when it is longer than the original text.

View attachment 5223188 View attachment 5223190
update:09-09-2025
updated file:realtimetrans.rpy
technical details:
1-Solved the cutting off problem .Tested in Renpy 8.3.0 and 7.5.2.
2-The translation text replacement method is changed totally. Instead of using Text.update, it replaces the token whose type is Text in renpy.text.text.Layout.segment. Text.update only collects texts to be translated.
3-The Text redisplay method is changed.Instead of using Text.set_text,it uses renpy.display.render.redraw(text_obj, 0) directly.
 
  • Like
Reactions: CAT0X0

cemo45

Newbie
May 29, 2018
17
1
126
Thank you so much for everything. It's currently translating, but it doesn't do it occasionally. I've attached the log file. Could you take a look and comment?
 
Jul 28, 2025
161
57
28
Thank you so much for everything. It's currently translating, but it doesn't do it occasionally. I've attached the log file. Could you take a look and comment?
According to your log file,Your api rate limit is
"X-RateLimit-Limit":"20" per min
Which means you can post no more than 20 requests per minute.
So the time_interval in transconfig.rpy should be equal or larger than 3.
 
Jul 28, 2025
161
57
28
According to your log file,Your api rate limit is
"X-RateLimit-Limit":"20" per min
So the time_interval in transconfig.rpy should be equal or larger than 3.
I understand than 3s time_interval is not realtime.So in next update , multi llm api-keys will be possible.So that time_interval could be set to 1s or less.