trouble translation menu items

stOrM!

Newbie
Sep 23, 2019
42
18
Hi,
sorry if this post is in the wrong thread I was unsure where it might fit best.

I must say I'm totally new to the Renpy APi but found a few Games which I'll want to translate to another language.
Well, while still trying to wrap my head around the stuff I gave it a quick try to see what I got and what I've to deal with...

I quickly stumbled about things developer's done wrong (or it's me who is missing something here...)
Well, to give an example the first game script had input boxes which looked like this if I'll remember correctly:

renpy.input"What's your first name?"

So when I would like to automatically let the Renpy API extract those strings it wont work so I had to make adjustments like this all over the place:

renpy.input(_("What's your first name?"))

So far so good not a big deal but then something strange happens because of a menu structure used by the developer:

Python:
    menu:
        "Nothing too crazy" if ch1sexstyle == False:
            $ ch1sexstyle = "lady"
            $ carli_score += 1
            jump ch1wantlady
        "Wild and naughty" if ch1sexstyle == False:
            $ carli_lust += 1
            $ ch1sexstyle = "slut"
            jump ch1wantslut
        "Deepthroat" if ch1sexstyle == "slut" and ch1throat == False:
            jump ch1wantdeepthroat
        "Anal" if ch1sexstyle == "slut" and ch1anal == False:
            $ ch1anal = True
            jump ch1wantanal
        "On with it" if ch1sexstyle:
            jump ch1donation
    jump ch1donation
in my translation template the following lines where added:

Code:
    old "Nothing too crazy"
    new ""

    # game/scene02.rpy:188
    old "Wild and naughty"
    new ""

    # game/scene02.rpy:188
    old "On with it"
   new ""
So as you might noticed two entry's (Deepthroat and Anal) are missing.
I've no clue why this happens nor how to fix this? A simple stupid idea I had first was manually
add them to the translation file which results in an already exist message which make it even more strange to me
because I'll looked everywhere basically in every script file it does not exist.

Well another strange thing which happen to me while talking about menu entry's was that some were shown after my
translation and some don't. I had to add a color value to them:

# not shown

"Test"

# while this worked for me

"{color=#ffeebb}Test{/color"}

Took me some time to figure this out is that normal? I'll guess not...

Hope someone can point me to the right direction.

API Version used: 7.3.5.606 on Macos 10.14.6
 

scrumbles

Engaged Member
Jan 12, 2019
2,277
2,331
Menu strings are translated just once, if identical. I am pretty sure the missing strings were used in another menu (either in the same script or in another one) and Ren'py skipped them.

Here's the solution from the :
When the same string is used in multiple places, the string can be distinguished using the {#...} text tag. Even though they display the same, Ren'Py considers all of these distinct strings for the purpose of translation:
Code:
"New"
"New{#project}"
"New{#game}"
"New{#playlist}"
 

stOrM!

Newbie
Sep 23, 2019
42
18
Menu strings are translated just once, if identical. I am pretty sure the missing strings were used in another menu (either in the same script or in another one) and Ren'py skipped them.

Here's the solution from the :

Code:
"New"
"New{#project}"
"New{#game}"
"New{#playlist}"
Hi,
I'm sure you're right that those strings might b used elsewhere but I'm still unable to locate them.

Code:
"New"
"New{#project}"
"New{#game}"
"New{#playlist}"
I'm reading the manual but now but I'm unsure of how to use that statement above

so for example:

old "Anal"
new "#Anal"

or how is it used?

At least i was able to found the copy of the strings in the script now. Well, now I've to deal with it somehow trail and error case for me...
 
Last edited:

scrumbles

Engaged Member
Jan 12, 2019
2,277
2,331
I fear you must edit the original script: if you are not the dev, you must talk to them and tell them to insert it.

This is an edited version of "The Question", the mini-game shipped with the SDK:

Code:
    menu:

        s "Sure, but what's a \"visual novel?\""

        "It's a videogame.":
            jump game

        "It's a videogame.{#anothercopy}":
            jump game

        "It's an interactive book.":
            jump book
As you can see, the {#...} is invisible:

screenshot.jpg

When you generate the translations:
Code:
    # script.rpy:105
    old "It's a videogame."
    new "It's a videogame."

    # script.rpy:105
    old "It's a videogame.{#anothercopy}"
    new "It's a videogame.{#anothercopy}"

    # script.rpy:105
    old "It's an interactive book."
    new "It's an interactive book."
EDIT: of course, the {#...} syntax is mandatory only if identical strings must be translated differently. I don't see the issue with "anal" and "deepthroat".
But if you have something like:
- Give it to XXX
where "it" is an object (and in some languages, objects have a gender), it may be useful to have different entries.
 
Last edited:

stOrM!

Newbie
Sep 23, 2019
42
18
I fear you must edit the original script: if you are not the dev, you must talk to them and tell them to insert it.

This is an edited version of "The Question", the mini-game shipped with the SDK:

Code:
    menu:

        s "Sure, but what's a \"visual novel?\""

        "It's a videogame.":
            jump game

        "It's a videogame.{#anothercopy}":
            jump game

        "It's an interactive book.":
            jump book
As you can see, the {#...} is invisible:


When you generate the translations:
Code:
    # script.rpy:105
    old "It's a videogame."
    new "It's a videogame."

    # script.rpy:105
    old "It's a videogame.{#anothercopy}"
    new "It's a videogame.{#anothercopy}"

    # script.rpy:105
    old "It's an interactive book."
    new "It's an interactive book."
EDIT: of course, the {#...} syntax is mandatory only if identical strings must be translated differently. I don't see the issue with "anal" and "deepthroat".
But if you have something like:
- Give it to XXX
where "it" is an object (and in some languages, objects have a gender), it may be useful to have different entries.
Ok thank you!
I'll guess I've got it now.
I'm wondering while this is all new to me(Renpy and Python itself I'm coming fron another programming background instead) if it would make sense (or at least would make a difference) to just declare both strings as a global var when the developer choice was to use it on multiple places...

No clue if that will translate without any errors I've not tested it yet just thinking.
 

scrumbles

Engaged Member
Jan 12, 2019
2,277
2,331
Me neither, but I guess it would work.
For a non-dev, the {#...} syntax is easier to read, I suppose.

On a side note, this string from your first post
Code:
 renpy.input"What's your first name?"
is ignored not only when Ren'py generate the translations, but also when it extract the full dialogue. In this case too, the (_("...")) syntax does the trick.
 

stOrM!

Newbie
Sep 23, 2019
42
18
Me neither, but I guess it would work.
For a non-dev, the {#...} syntax is easier to read, I suppose.

On a side note, this string from your first post
Code:
 renpy.input"What's your first name?"
is ignored not only when Ren'py generate the translations, but also when it extract the full dialogue. In this case too, the (_("...")) syntax does the trick.
I think so too guess I could try tomorrow will come back and let you know maybe that could be useful for others which had similiar problems while translating...

You're also right with: "when it extract the full dialogue"
I'll guess the developer never had translations in mind or use other tools to make it work in some way.