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

pepplez

Active Member
Jun 7, 2020
990
1,331
287
But the idea of direct button is great.
I think a draggable toggle button would be more appropriate.
Awesome Translator tool, here's a suggestion for your on screen draggable toggle button, its a bit hacky but functional.
Tested with your Translator files, drop it in the games game folder to add the button.
 
  • Like
Reactions: AliVeli49
Jul 28, 2025
161
57
28
update:25-09-2025
updated file:realtimetrans.rpy
1-Text-to-HTML and HTML-to-text now use <code></code> to protect Renpy code from translation, rather than <code id=texthash></code>
2-Fix bug for not translating texts when developers using
show text Text()
by collecting texts to be translated in function
renpy.text.text.Layout.segment.

The realtime translator works very well so far, but every now and then I have lines that are not translated.
The log then shows the following:

Traceback (most recent call last):
File "C:\Prog\Games\ChasingSunsets-1.10-pc\renpy\exports.py", line 3766, in run
fn(*args, **kwargs)
File "game/realtimetrans.rpy", line 96, in translation_thread
translations = translate_batch(texts_to_translate,TARGET_LANGUAGE)
File "game/realtimetrans.rpy", line 574, in translate_batch
protected_text = COMBINED_PATTERN.sub(
TypeError: expected string or bytes-like object
3-Add a translation display button, the ◀ button in the top right of the screen. It doesn't disable translation, only the translation display.It's not draggable, but it is semi-transparent and small enough.
Thanks for pepplez 's code ,it's really inspiring.
 
Jul 28, 2025
161
57
28
Hello, so far everything is fine, but I get an exception error see traceback.txt.
Edited:I repeated the problem.
It will be fixed in next update.
The error is because tokens are not turning image tags into displayable object.
 
Last edited:
Jul 28, 2025
161
57
28
update:26-09-2025
updated file:realtimetrans.rpy
1-Replace <code></code> with <p translate="no"></p> to protect renpy code from being translated.
2-Fixed image tag display problem.
 
  • Like
Reactions: trans1 and Nobre

trans1

Newbie
Jan 24, 2023
25
0
124
By the way, a game with Ren'Py 7.3.5.606 no longer has a translation. Up to version v0.15 it still worked.
Nothing can be seen in the log file. The file translation_cache.json is also not created.
But the translation display button reacts.
 
Jul 28, 2025
161
57
28
By the way, a game with Ren'Py 7.3.5.606 no longer has a translation. Up to version v0.15 it still worked.
Nothing can be seen in the log file. The file translation_cache.json is also not created.
But the translation display button reacts.
I noticed the problem ,but i decided to fix problems reported in this thread first, then make it work in older versions.
The reason it not work in Renpy 7.4.0 before is that Text.Layout.segment function updated in Renpy 7.4.0,
I will try to make it work in next update as long as there are no more significant bugs.
 
Last edited:

trans1

Newbie
Jan 24, 2023
25
0
124
OK. I have another exception error that always occurs with texts containing {sc=*} ... {/sc}.
 

trans1

Newbie
Jan 24, 2023
25
0
124
I've been testing your Mod for a while now, and it actually works very well.

This raises the question: is the text between {i} and {/i} translated separately from the rest of the text?
The translation is somehow much worse and often distorts the meaning compared to when I enter the sentence directly into Google Translate.
This is bad for translation into German, but I don't know how it is with other languages.

Examples:
translation_cache: "\"We know why you left, Son...We {i}always{/i} knew.\"": "„Wir wissen, warum du gegangen bist, Sohn … Wir {i} stets {/i} wusste.“",
Google Translater: „Wir wissen, warum du gegangen bist, Sohn … Wir haben es {i}immer{/i} gewusst.“

translation_cache: "\"Wait, all this time you {i}knew{/i}?!? And you didn't do anything about it?\"": "\"Warte, die ganze Zeit hast du {i} wusste{/i}?!? Und du hast nichts dagegen unternommen?\""
Google Translater: „Warte, du hast es die ganze Zeit {i}gewusst{/i}?!? Und du hast nichts dagegen unternommen?“
 
Jul 28, 2025
161
57
28
I've been testing your Mod for a while now, and it actually works very well.

This raises the question: is the text between {i} and {/i} translated separately from the rest of the text?
The translation is somehow much worse and often distorts the meaning compared to when I enter the sentence directly into Google Translate.
This is bad for translation into German, but I don't know how it is with other languages.

Examples:
translation_cache: "\"We know why you left, Son...We {i}always{/i} knew.\"": "„Wir wissen, warum du gegangen bist, Sohn … Wir {i} stets {/i} wusste.“",
Google Translater: „Wir wissen, warum du gegangen bist, Sohn … Wir haben es {i}immer{/i} gewusst.“

translation_cache: "\"Wait, all this time you {i}knew{/i}?!? And you didn't do anything about it?\"": "\"Warte, die ganze Zeit hast du {i} wusste{/i}?!? Und du hast nichts dagegen unternommen?\""
Google Translater: „Warte, du hast es die ganze Zeit {i}gewusst{/i}?!? Und du hast nichts dagegen unternommen?“
The texts to be translated are encoded to html form text.
Renpy code tag will be protected with <p translate="no"></p> ,and each text is separated with html structures too,
so that the translated html can be decoded back to text and not change Renpy code in texts,or errors will occur.
To be honest,i have no idea how google translate dealing with protected html.
If you want better translation quality,llm trans is provided.
 
Jul 28, 2025
161
57
28
I've been testing your Mod for a while now, and it actually works very well.

This raises the question: is the text between {i} and {/i} translated separately from the rest of the text?
The translation is somehow much worse and often distorts the meaning compared to when I enter the sentence directly into Google Translate.
This is bad for translation into German, but I don't know how it is with other languages.

Examples:
translation_cache: "\"We know why you left, Son...We {i}always{/i} knew.\"": "„Wir wissen, warum du gegangen bist, Sohn … Wir {i} stets {/i} wusste.“",
Google Translater: „Wir wissen, warum du gegangen bist, Sohn … Wir haben es {i}immer{/i} gewusst.“

translation_cache: "\"Wait, all this time you {i}knew{/i}?!? And you didn't do anything about it?\"": "\"Warte, die ganze Zeit hast du {i} wusste{/i}?!? Und du hast nichts dagegen unternommen?\""
Google Translater: „Warte, du hast es die ganze Zeit {i}gewusst{/i}?!? Und du hast nichts dagegen unternommen?“
Of course, it is possible to improve the structure of the HTML to be translated to improve the translation quality, but I think this is a long-term process that requires a lot of testing and is far less important than solving low-version compatibility and error problems first.
If you want know more, read the code.
Other tranlators using google replace renpy code with special symbols, i think the method is not stable enough for real time trans.
 
Last edited:
Jul 28, 2025
161
57
28
I've been testing your Mod for a while now, and it actually works very well.

This raises the question: is the text between {i} and {/i} translated separately from the rest of the text?
The translation is somehow much worse and often distorts the meaning compared to when I enter the sentence directly into Google Translate.
This is bad for translation into German, but I don't know how it is with other languages.

Examples:
translation_cache: "\"We know why you left, Son...We {i}always{/i} knew.\"": "„Wir wissen, warum du gegangen bist, Sohn … Wir {i} stets {/i} wusste.“",
Google Translater: „Wir wissen, warum du gegangen bist, Sohn … Wir haben es {i}immer{/i} gewusst.“

translation_cache: "\"Wait, all this time you {i}knew{/i}?!? And you didn't do anything about it?\"": "\"Warte, die ganze Zeit hast du {i} wusste{/i}?!? Und du hast nichts dagegen unternommen?\""
Google Translater: „Warte, du hast es die ganze Zeit {i}gewusst{/i}?!? Und du hast nichts dagegen unternommen?“
One improvement would be to convert all markup codes in Renpy text into HTML tags, since Google Translate does not translate HTML tags.
This is something I'm currently planning to do once all bugs are fixed.
If you'd like to do some improvements in this project, this is a good reference.
 
Jul 28, 2025
161
57
28
One improvement would be to convert all markup codes in Renpy text into HTML tags, since Google Translate does not translate HTML tags.
This is something I'm currently planning to do once all bugs are fixed.
If you'd like to do some improvements in this project, this is a good reference.
The Google Translate API currently used by the translator is derived from the Chrome browser's web translation API, so the quality may differ from the paid API or the Google Translate web translation.

We chose the browser-based Google Translate API because it has been tested and found to be more effective than the web version.
 

trans1

Newbie
Jan 24, 2023
25
0
124
I really like your project and would love to help, but I don't know anything about Renpy, Python, or HTML programming.
 

trans1

Newbie
Jan 24, 2023
25
0
124
After reading a lot and trying out different things, I found a solution that significantly improves the translation.
I replaced <p translate="no">{0}</p> with <span translate="no">{0}</span>.
However, I am still testing whether this causes other errors.
 
Jul 28, 2025
161
57
28
OK. I have another exception error that always occurs with texts containing {sc=*} ... {/sc}.
ScaredText's mechanism is to create single character jumping Text objects, which conflicts with the implementation mechanism of the program. The current program is only suitable for processing text translation of one single Text object.
To solve this problem, the changes required are not worth it in my opinion.
 

trans1

Newbie
Jan 24, 2023
25
0
124
Are you sure you have uploaded the correct file? Winmerge shows no difference to v0.17