Ren'Py Tutorial Translating Ren'Py games: a comprehensive guide -v2.0 (Dec 2021)

5.00 star(s) 1 Vote

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
¡Hola!

After more than three years playing and manually translating into Spanish (and for PC) several Ren'Py games of diverse complexity, I have encouraged myself to write this guide to explain the translating process to anyone who want to start translating or are curious enough to know what I spend my spare time on.

I try to explain the basics but there are also some useful tricks to achieve the "perfect" translation: text variables, character's names, identical strings with different meanings, and some other problems we may face when translating any Ren'Py game. Although the tutorial is intended to help manual translators, it can be used to get a better understanding of the whole process even if you use machine translators for the actual translating work.

Thanks in advance for your comments, suggestions and corrections (and I swear I'm a lot better translating from English to Spanish than doing the reverse translation :ROFLMAO:).

You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Here's the original Spanish version / Aquí está la versión original del tutorial en español

-archivo movido al post inicial-
 
Last edited:
  • Like
Reactions: Green Rookie

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
hola, ¿no pudiste hacer un video que muestre cómo hacer la traducción?
Entre hacer una serie de vídeos para contar todo lo que habría contar y escribir una guía de 30 páginas, prefiero escribir la guía. En youtube ya hay algún videotutorial básico
 

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Updated to v1.01 with an important typo fix in the code presented to allow changing languages on the preferences menu
----
Actualizado a la versión 1.01 con una corrección importante en el código ofrecido para permitir el cambio de idioma en el menú preferencias
 
Mar 29, 2018
44
33
Hi,

thank you for the guide, it was really good and detailed.
I just encountered one problem while translating a Ren'Py game, but I didn't find a solution (by myself or by reading the guide).

I followed the guide and created my translation folder (tl\french), all is well, until I bumped into this when starting the game:

Capture.JPG

I want to translate this "You" into "Moi" ("Me" in French). It should be simple, so I start looking for it in the original script.rpy and I find it.

Capture2.JPG

It didn't appear in the translation script.rpy but that's ok since there is the solution of adding _() around that specific "You". I should also add {#something} so that it would tell the difference between this "You" and all the others. It worked because it now appears in the translation script.rpy.

However, when I translate the old "You{#something}" into a new "Moi",

Capture3.JPG

It doesn't work as intended and I end up with "You" even when playing the French version.

Capture4.JPG

So, I think I understood part of the problem. Actually, later in the game, the character will be asked his name, so there are a few functions at the beginning of the script.

Capture5.JPG

Capture6.JPG

Because of these functions, I can't seem to be able to translate this "You", whatever I do. I've tried to translate both "You" at line 147 and 451 after adding {#} to diferentiate them, but that doesn't do the trick. I've also searched for any other "You" in the script but those are the only two.

Later, when the character gets asked his name, there are no more problem, the "You" will be replaced by the name chosen by the player, but this is only after a few minutes so I can't leave it like this.

Do you know what I should do ?
Maybe there's a function somewhere that I should add in the translation file? Maybe I can try to modify or create a new function in the original script but I don't know python so it's certainly not my best option.
 
Last edited:

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Hi,

thank you for the guide, it was really good and detailed.
I just encountered one problem while translating a Ren'Py game, but I didn't find a solution (by myself or by reading the guide).

I followed the guide and created my translation folder (tl\french), all is well, until I bumped into this when starting the game:

View attachment 1454944

I want to translate this "You" into "Moi" ("Me" in French). It should be simple, so I start looking for it in the original script.rpy and I find it.

View attachment 1454945

It didn't appear in the translation script.rpy but that's ok since there is the solution of adding _() around that specific "You". I should also add {#something} so that it would tell the difference between this "You" and all the others. It worked because it now appears in the translation script.rpy.

However, when I translate the old "You{#something}" into a new "Moi",

View attachment 1454949

It doesn't work as intended and I end up with "You" even when playing the French version.

View attachment 1454951

So, I think I understood part of the problem. Actually, later in the game, the character will be asked his name, so there are a few functions at the beginning of the script.

View attachment 1454954

View attachment 1454957

Because of these functions, I can't seem to be able to translate this "You", whatever I do. I've tried to translate both "You" at line 147 and 451 after adding {#} to diferentiate them, but that doesn't do the trick. I've also searched for any other "You" in the script but those are the only two.

Later, when the character gets asked his name, there are no more problem, the "You" will be replaced by the name chosen by the player, but this is only after a few minutes so I can't leave it like this.

Do you know what I should do ?
Maybe there's a function somewhere that I should add in the translation file? Maybe I can try to modify or create a new function in the original script but I don't know python so it's certainly not my best option.
Thanks! It's always nice to hear someone is actually using the guide.

Now, with your problem. The player's character is defined like this: define p = Character('[pname]', color ='#888888'), so it's actually a text variable within a text variable (the Character definition). As in this case that variable [pname] takes another value before the player inputs their desired name, the way to display the translation for that value is by using the !t append.

The 'perfect' solution would be editing the original script to look like this:
define p = Character('[pname!t]', color ='#888888')

This way you wouldn't need to do anything else, as you have already translated the value 'You' (or 'You{#something}' after your change) and Ren'Py will pick the translated string when displaying it in French, and the original one when the game is played in English. But that would force you to add that script to your patch in order to carry over the !t to the player's game, and you don't really need it to make it work.

So just add these lines to your translation file:
Python:
old = "[pname]"
new = "[pname!t]"
Which is the result of extracting the string '[pname]' with the _() thing -> define p = Character(_('[pname]'), color ='#888888'). That should do the trick.

I'm currently working on a 2.0 version of the guide and I'll probably add this example to it. It's not very common that a game allows you to input your desired name while also using another default (and translatable) one first, but it's not the first time I see it either so I guess it's worth to mention.
 
  • Red Heart
Reactions: Arcade Kylo Ren
Mar 29, 2018
44
33
Ah, yes, the !t append. I completely forgot about it.
Funny thing is, when I read this part of the guide, I didn't understand it very well and didn't think I would need it.
Turns out this was important. :ROFLMAO:

Anyway, I've tried it and it works like a charm!

Thanks a lot for your help! :D
 
  • Like
Reactions: moskyx

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Ah, yes, the !t append. I completely forgot about it.
Funny thing is, when I read this part of the guide, I didn't understand it very well and didn't think I would need it.
Turns out this was important. :ROFLMAO:

Anyway, I've tried it and it works like a charm!

Thanks a lot for your help! :D
Yeah, I think the point of the !t is missing due to the complexity of that example. I'll try to change it too, as it's actually a very important tool. Glad it worked.
 

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
A revamped (and extended) version is now live! Now with a quick starting guide, plus a bunch of new sections: translating updates, translating from other translations, new 'last resort' utilities, and better patching methods, just to name a few. There's a full changelog in the OP.

It's highly recommended to forget about the guide's old version and start working with this one.
 
Last edited:
  • Like
Reactions: Vorr

BlackRing

Newbie
Apr 27, 2021
37
31
Hi moskys!
Thank you for your guide. It really halped me a lot, especially about making a patch.
But I still have 2 unsolved problems, both about fonts.

The first is if the dev uses "what_font" to define the font of a character's dialogue, how do I change this font since my language is not included in it?
Python:
define p_t = Character ("[name]'s thoughts", color="#415da3", what_font="aleo-italic-webfont.ttf")
define p_d = Character ("[name]'s memories", color="#415da3", what_font="aleo-italic-webfont.ttf")
I tried init block, but that would change the font in English.

The second is, I know how to redefine the specific element of a style, but what about the font of a text? I tried the same code as style and it failed.
Python:
screen _scr_stats_button_cs_name(who):
    vbox:
        pos (110, -10)
        xsize 200
        spacing 0
        text who.name:
            size 48
            color "cfcfcf"# who.color
            font "TeachDemo-Regular.otf"
            drop_shadow (1, 1)
            drop_shadow_color "#333"

        text "Level {}".format(who.friendship):
            yoffset -10
            size 24
            color "cfcfcf"# who.color
            drop_shadow (1, 1)
            drop_shadow_color "#333"
            font "TeachDemo-Regular.otf"
# end screen
Do you know what I should do if I don't change the original code?
 

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Hi moskys!
Thank you for your guide. It really halped me a lot, especially about making a patch.
But I still have 2 unsolved problems, both about fonts.

The first is if the dev uses "what_font" to define the font of a character's dialogue, how do I change this font since my language is not included in it?
Python:
define p_t = Character ("[name]'s thoughts", color="#415da3", what_font="aleo-italic-webfont.ttf")
define p_d = Character ("[name]'s memories", color="#415da3", what_font="aleo-italic-webfont.ttf")
I tried init block, but that would change the font in English.

The second is, I know how to redefine the specific element of a style, but what about the font of a text? I tried the same code as style and it failed.
Python:
screen _scr_stats_button_cs_name(who):
    vbox:
        pos (110, -10)
        xsize 200
        spacing 0
        text who.name:
            size 48
            color "cfcfcf"# who.color
            font "TeachDemo-Regular.otf"
            drop_shadow (1, 1)
            drop_shadow_color "#333"

        text "Level {}".format(who.friendship):
            yoffset -10
            size 24
            color "cfcfcf"# who.color
            drop_shadow (1, 1)
            drop_shadow_color "#333"
            font "TeachDemo-Regular.otf"
# end screen
Do you know what I should do if I don't change the original code?
Hi! Glad to know someone else is finding the guide useful. Sadly, I wouldn't know how to fix your issues without impacting the original version, I'm not that skilled. Maybe try asking in the dev's help subforum? It's worth a try
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,864
16,015
The first is if the dev uses "what_font" to define the font of a character's dialogue, how do I change this font since my language is not included in it?
[...]
The second is, I know how to redefine the specific element of a style, but what about the font of a text? I tried the same code as style and it failed.
I don't know its effective scope, therefore if it would works for those particular cases, but to assign a specific font for a translation, it's translate_font. you can , and therefore define a different font depending of it.



Edit: I'm awake now...
 
Last edited:

BlackRing

Newbie
Apr 27, 2021
37
31
Hi! Glad to know someone else is finding the guide useful. Sadly, I wouldn't know how to fix your issues without impacting the original version, I'm not that skilled. Maybe try asking in the dev's help subforum? It's worth a try
Thank you for your help! I'll try it later.

I don't know its effective scope, therefore if it would works for those particular cases, but to assign a specific font for a translation, it's .
Thanks for your advice! I tried the init python block
Python:
init python:
    translate_font("language", "myfont.ttf")
But an error occurred:
NameError: name 'translate_font' is not defined
I tried it in several games with different Ren'Py versions but they all had this problem. I don't know much Python, so I'm a little confused.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,864
16,015
Thanks for your advice! I tried the init python block
Oops...
Totally messed it, it's absolutely not the right "translate" document. It obviously should have been , not a SDK translation.

Really need some day off :(
 

cmnb99

Newbie
Apr 25, 2023
19
0
Hello, my friend, I am currently translating the Straitened Times game, and I have been able to extract the texts, and this is thanks to you. Thank you, but I have a question. Is there a way to do automatic translation of the texts? Without exposure to programming code?
 

moskyx

Forum Fanatic
Jun 17, 2019
4,177
13,805
Hello, my friend, I am currently translating the Straitened Times game, and I have been able to extract the texts, and this is thanks to you. Thank you, but I have a question. Is there a way to do automatic translation of the texts? Without exposure to programming code?
Glad you found it useful. I know there are some tools that do machine translations but I never used them so I can't really help you with that. Try browsing and asking in the translation subforum
 
5.00 star(s) 1 Vote