Ren'Py Problem with translation (random choice, tag text) / SOLVED

moskyx

Engaged Member
Jun 17, 2019
3,855
12,382
I'm working on a translation of a Ren'Py game and found a quite uncommon problem. In one scene there's a random choice function that generates different questions to be shown in a screen, and the player can click on this questions to jump to their respective label. So the whole thing looks like this:

Python:
screen ask_about:
    layer "navlayer2"
    frame:
        xpadding 75
        ypadding 27
        xalign 0.15
        yalign 0.95
        grid 1 3:
            spacing 2
            xpos 0.03
            ypos 0.05
            for i in current_choices:
                textbutton _("+current_choices[i]+"):
                    text_style "text_screen_choice_font"
                    action Jump(i)
                    xalign 0.5
                    yalign 0.5


label ask_about_new:
    $ current_choices = {}
    $ ask_about_choices = {
    1: {
        "stg_ask_about3":"Question 3",
        "stg_ask_about6":"Question 6",
        "stg_ask_about9":"Question 9"
        },
    2: {
        "stg_ask_about1":"Question 1",
        "stg_ask_about4":"Question 4",
        "stg_ask_about7":"Question 7"
        },
    3: {
        "stg_ask_about2":"Question 2",
        "stg_ask_about5":"Question 5",
        "stg_ask_about8":"Question 8"
        }

    }

    python:
        for i in range(1,4):
            tag, text = renpy.random.choice(list(ask_about_choices[i].items()))
            current_choices[tag] = text
So the screen shows 3 questions randomly (one from each group of 3) in the grid, but I cannot make that text ("Question 1", "Question 2", and so on) translatable. I've tried putting the regular _( ) thing on each one but it breaks the code. Also tried the __( ) and some other combinations with the [!t] tag with no results because, basically, all of them need the _( ) thing wrapping each question and this leads to an exception (line $ ask_about_choices = { is not terminated on a new line).

Does anyone here know how to fix this? Thanks


---

EDIT:
Ok, don't know what the hell happened here but now I can translate those questions without any problems just with the __( ) symbol used for translating variables. I swear it broke the code just a couple of hours ago, guess a Ren'py restart did the trick. Don't mind me
 
Last edited: