Home Creators Posts Import Register Favorites Logout

Content

Good health, dear Cossacks!!! Welcome to the second part of the guide to translating games on the Ren'py engine. Here we will get introduced to both the basics of translation (dialogues and strings) and more complex issues(styles). So, let's get started!

OPENING THE PROJECT. Launch Ren'py Launcher, select a game, and click on the ‘Open Project’ option in the “Edit” section (screenshot 1). You will see that the editor on the left has the entire structure of your game in the vertical ‘Explorer’ tab. This will help you navigate without having to open files directly through Windows Explorer. Remember that you will only be translating in the ‘tl’ folder. So, let's finally get to it.

DEVELOPER MODE. But first, you need to make one small adjustment. Using VS Code navigation, go to ‘game/code/init/default/’ and open the options.rpy file. The first active line you will see is ‘define config.developer = False’ (screenshot 2). Change its value to True. We will need this in the future to ensure maximum comfort when translating the game. Ah, and congratulations on becoming a developer :).

COMPARING FILES. For better understanding, we suggest you take the first file in the story chronology – street.rpy – from the path ‘code/plot/prologue’. Open the original file and the translation file (the one in the ‘tl’ folder) with the corresponding names using VS Code navigation (screenshot 3).

ORIGINAL SCRIPT FILE. Roughly speaking, only three elements are important for translation in Ren'py: characters, strings and styles. All conversations in the game are carried out through characters.

Pay attention to line 27 (screenshot 4) and its structure. In general, it looks like this: [<character name> ‘<his phrase>’]. As you can see, it has a clear division between the character (in this case, ‘tv’) and his phrase in quotation marks, ‘Today in our show we-...’. This is the basic structure, and 90% of the text is in the hands of the characters. To control their emotions, there are usually special settings for this before the character's phrase (screenshot 5). We should also mention a special character – the narrator. There is no clear designation for this character, and it is simply announced with ‘<Phrase>’. At the beginning of the file, the narrator is used, as you can see (screenshot 6).

Now that you have a basic understanding of characters in a regular file, we can move on to translation files.

TRANSLATION FILE. Now it's time to look at the relevant file in the ‘tl’ folder. And there you will see something interesting. One of the main advantages of translation in Ren'py is that all translations for characters and the narrator are created automatically! In fact, the translation is created in the following way: a character and their phrase are taken, a unique identifier is created for them, which the engine will refer to when using your language in the game (screenshot 7).

!!!Attention!!! Do not change the identifier under any circumstances, otherwise the translation for your character will not be found. All you need to do is insert the translation into your language in these quotation marks. Please note that before the character's line, you can see a comment (any line beginning with #) that indicates which phrase is spoken by the character. This is done so that you can understand exactly which phrase this identifier refers to.

THE TRANSLATION DOES NOT FIT ON THE SCREEN. Rarely, but when translating character phrases, there may be situations where the text is too large and does not fit in the allocated window. There are two types of character phrase displays in the game - ADV and NVL, each of which has an individual approach to this problem.

ADV mode is the usual dialogue window for characters that you see most of the time (screenshot 8). To fix the problem when the dialogue window cannot fit all the translated text, we need to split it into parts. How do we do this? Fortunately, Ren'py allows you to split sentences into parts in the identifier itself, and there is no strict requirement to follow the structure of the original file. This means that we can easily split a character's phrase into two phrases without any problems (screenshot 9).

!!!IMPORTANT!!! If you are working with a phrase that expresses emotion, you need to divide it correctly into two parts. Let's consider two possible options: simple emotion and complex emotion.

Simple emotion – the character expresses one emotion. In this case, you leave the first phrase unchanged and remove the emotion from the second (screenshot 10).

Complex emotion – contains two emotions at the same time, one when the character is speaking and the other after they have finished speaking (i.e. the player has clicked and received a new phrase). You will understand that the character has two emotions by the characteristic symbol ‘@’, where the emotion on the right is displayed during the phrase, and the one on the left after it (screenshot 11). To keep everything correct when splitting the phrase, you must move the complex emotion entirely to the second phrase, leaving only the second emotion in the first phrase (screenshot 12).

NVL mode is a full-screen window that is also often used in our game (screenshot 13). As in ADV, we can split character phrases into parts, but the main feature of NVL is that the displayed text must be erased manually (in our case). When there is too much text on the screen, a special operator ‘nvl clear’ is used. You will often see it among the conversation identifiers in the translation files.

So, if you want to display a large amount of translation text nicely, you need to rework the current window of phrases until the next ‘nvl clear’. We do this as follows: we make two pages from one NVL page, i.e. we insert ‘nvl clear’ somewhere in the middle of the text (in any of the identifiers), and then we arrange the phrases nicely on the first and second pages respectively (screenshots 14-15).

STRINGS IN TRANSLATION FILES. If everything is clear with the dialogues, what about everything else? Because the game also has an interface — the main menu, mini-games, system messages, the journal system, combat, transitions, special texts, and much more.

And here we use our second element – strings. All text that is declared outside of characters is strings. And their translation method is slightly different. In the translation file street.rpy, scroll to the very bottom. You will see the following structure – ‘translate YourLanguage strings’ (screenshot 16). After that, the strings for translation are presented with the following structure (screenshot 17):

# - a comment indicating on which line of the original file the string is located

old - the original string (!!!do not change, otherwise the string will not be translated!!!)

new - the translated string

Together with the conversations, this is enough to translate the entire game. But we haven't discussed the last important element yet — styles. Because so far, it's all raw text, which, although mostly stylised and given properties from the game, will look clumsy in many places in your language.

STYLE IN TRANSLATION FILES. The text in the game is not just words; it always has a size, font, colours, indents, and position in the menu. In translation, this is controlled by a special Ren'Py construct called ‘style translate’. Remember that style changes the appearance of text for a specific language. This is very useful because different languages have different phrase lengths, letter sizes, font requirements, etc.

HOW STYLES WORK. Note that styles do not always need to be translated. The default style used in the original files may be perfectly suited to the text in your language and take up the same amount of space. IN OTHER WORDS, you should only translate styles that cause display problems in the interface!!! Therefore, we recommend that you first read what style you are translating and try to translate it only if the text is displayed incorrectly.

HOW TO READ STYLES. Before translating styles, you must clearly understand that you have selected the style that corresponds to the desired interface text. Let's take, for example, the Ukrainian translation file game_time.rpy located at ‘tl/Ukrainian/code/mechanics/basic/’. Let's look at the text styles – ‘user_gui_time_text’, “user_gui_week_text”, ‘user_gui_week_num_text’. If the style name clearly includes the word ‘text’, you can be sure that it is part of the interface text. The style name always makes it clear which part of the interface it refers to (screenshot 18). But it is always better to check your changes – that way you can be sure that everything went well.

WHERE CAN I GET STYLES FOR TRANSLATION? The good news is that the Ukrainian translation has already been completed and all translated styles have already been defined there. You can transfer all the necessary ‘translate styles’ from the Ukrainian translation file game_time.rpy to yours, and then replace the name ‘Ukrainian’ with the name of your language (screenshot 19). !!!Attention!!! The name of the language must match the one you entered when creating the translation via Ren`py Launcher (if you don't remember, the name of your translation folder corresponds to this). If you start the game, you will definitely see that the upper window of the interface has changed after saving the file (screenshot 20). However, it may happen that the text disappears completely after these changes. What is the problem? The answer is in the next section.

FONT. The reason for the disappearance of your text may be the incompatibility of the selected font with your language. Let's look at the first style, ‘user_gui_time_text’ — its first property is the font fira_sans.ttf. That is, to solve this problem, you need to find a font that is supported for your language. For convenience, please add your font to the ‘fonts’ folder in the ‘game’ directory, and then replace the name with the one you need in this style.

!!!IMPORTANT!!! If you have fonts that are not supported by the basic font in English, you MUST obtain all styles from the Ukrainian translation and translate them in your files. Replace the font name ‘fira_sans’ with the name of your font. That is, if you are translating one file, please check if there are any styles in the Ukrainian translation file that need to be translated (font change) (screenshot 21). Be especially careful in such ‘code’ directories as “init” and ‘mecnanics’ — 99% of the entire game interface is located there.

OTHER STYLE PROPERTIES. Let's briefly go over the most common properties used for text in the game. They will help you understand what exactly needs to be changed in the style translation to achieve the desired result. Here is a list of the main properties:

size – defines the size of the text

xpos – defines the position of the text in pixels; if the value is positive, it shifts to the right, if negative, to the left. That is, if you have a value of 20 and you need to move another 10 pixels to the right, the value should become 30.

ypos - defines the position of the text in pixels; if the value is positive, it shifts down; if negative, it shifts up. That is, if you have a value of 20 and you need to move another 10 pixels down, the value should become 30.

xoffset, yoffset – consider them analogues of xpos and ypos, they work similarly.

xalign, yalign – consider them analogues of xpos and ypos, with one important difference: their values are defined from 0.0 to 1.0. For example, for xalign, a value of 0.0 means left, 0.5 means centre, and 1.0 means right. The same applies to yalign, only instead of left and right, it is top and bottom.

pos, offset, align – these are shorthand forms for specifying the position of two coordinates at once. That is, it simply means pos(xpos, ypos), offset(xoffset, yoffset), align(xalign, yalign) (screenshot 22).

Other text properties are much less common and in most cases do not need to be changed, but we will leave a link to the official documentation of the engine for reference.

!!!TIP!!! Always use the style properties that were used in it. For example, it is a bad idea to set xpos for a style that is defined via xalign. Always use what the style gives you if it concerns positioning rather than the appearance of the text.

TAGS, VARIABLES, AND SPECIAL CHARACTERS IN TEXT. Text in a game can change form not only depending on style.

Very often, developers can directly add style properties to the string, also known as tags. Its feature is that it provides greater flexibility and allows you to specify the desired part of the text, rather than the entire text, but always requires strict following of the syntax – ‘{tag=value}Desired part of the text{/tag} further text-…’(screenshot 23). You also need to use tags where they apply to preserve the original design. This is not that difficult, as you can simply take it from a character's comment, restructuring it to fit the structure of your language.

The same applies to variables — you must transfer everything that is in the string for a correct translation. If you see a strange construction that is enclosed in square brackets ‘[]’ or has the structure ‘name.something’ — transfer these parts without changes (screenshot 24).

Special characters – if there are double %% or \" inside the string in the text, you MUST add them yourself. Otherwise, the engine will throw an error (screenshot 25). This is because the engine needs to be told that this is just a character and not part of its syntax.

To learn more about everything written above, here is a link to the Ren'py documentation on text. It describes all possible tag properties that can be used, as well as segment for variables and all possible special characters.

SPRITES FOR TRANSLATION. Although not very often, there are cases in development when it is inconvenient or impossible to translate something using the available tools. If you go to the main Ukrainian translation folder, you will see that there is not only a ‘code’ folder, but also various sprites — interface elements, buttons, and some locations. All of them contain text that is easier to translate manually using an image editor than through the engine (or so we thought before). This is NOT MANDATORY work, but if you want to achieve a complete translation in the game, you need to completely recreate the same structure in your translation folder and insert the translated sprites there.

!!!IMPORTANT!!! The folders and sprite names must be identical to those in the Ukrainian translation. Otherwise, they simply won't be displayed by the engine when playing the game (screenshot 26).

CHECKING THE LANGUAGE IN THE GAME. In order to check the part of the translation you have done, let's modify the hotkeys in developer mode a little.

Find the original screens.rpy file at ‘game/code/init/default/’. There we need ‘screen quick_menu():’ on line 287. You can see lines there that start with ‘if config.developer:’, add this line there - ‘key “c” action Language(‘YourLanguageName’)’(screenshot 27). Now, when you press the ‘c’ key on the English keyboard, the game language will change to your language. If you need English again, just press the English ‘e’ key.

!!!IMPORTANT!!! When switching languages in this way, it is not possible to rollback, so keep this in mind when deciding to test something.

USEFUL HOTKEYS. To facilitate the translation process, we provide you with a list of useful hotkeys:

Shit + R – recompiles the game, returning you to where you left off (often when saving files, the data may not be updated, so this forced reload will definitely help with that; we also recommend rolling back a couple of phrases).

Shift + E – automatically opens the line you are on in the VS Code editor (if activated in English, it will send you to the line in the original file). This is useful for finding where you are in the plot.

Ctrl + S – automatically saves the file in the VS Code editor. We think everyone knows this, but we'll write it down just in case.

RECOMMENDATIONS FOR THE TRANSLATION ORDER. We advise you to start with something easy – translating dialogues and strings. You can run the game and start a ‘New Game’ using Shift + E to immediately find yourself in the first script chronologically in the story. From here, you can start translating. Later, you can start figuring out the styles. But the best tactic is to tackle one thing at a time. That is, set yourself the goal of translating, for example, the task journal. First, translate all the strings, then move on to the styles. Translate one file at a time, seeing what the result is. Or translate the story file, that may be enough.

!!!IMPORTANT!!! It is advisable to translate the game in chronological order, otherwise we cannot guarantee that we will add it until it is completely ready (otherwise, if the game is half ready chronologically, we may consider it).

WHAT WE RECOMMEND POSTPONING FOR TRANSLATION. There will be a major overhaul of the combat system in the near future, so we would not prioritise translating its interface. It may happen that by the time you finish the translation, this work may already be wasted.

ADDING A LANGUAGE TO THE GAME. Let's imagine that you have already reached the final stage of translation. What should you do next? We advise you to contact us via Discord so that we can slowly start testing your translation. We also welcome you to prepare answers to the following questions in advance:

Translation – manual, machine or AI translation (all options can be combined)

Completion – indicate how much of the game plot has been translated

Interface – are there any problems with it, has it been checked in all places?

FINAL WORDS. This guide aims to provide basic skills for those who have never translated games or have no background in programming. That is why we have made many simplifications while writing it to make the information easier to understand. Even so, it turned out to be too long — it is impossible to lay out the basics and explain the principle of operation in a short form. But we wanted you to understand what you are doing and why, rather than just mindlessly inserting the translated text. We hope we have succeeded.

!!!CONGRATULATIONS!!! You have reached the end of the guide and acquired the basic skills for translation! This is the first version of the ‘Basics of Translation in Renpy’, so it will be improved in the future. If we have missed anything, please write about it in the comments or ask a question. Thanks for your attention!!! Budmo!!! Stand with Ukraine!!!

Files

Comments

No comments found for this post.