Problems with translation in image composite Text

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
thelastsecret
Regular
Posts: 121
Joined: Tue Mar 01, 2022 1:32 pm
Completed: The Last Secret
Projects: Sweet Science – The Girls from Silversee Castle
itch: thelastsecret
Discord: TheLastSecret #5266
Contact:

Problems with translation in image composite Text

#1 Post by thelastsecret »

In short: translations in Text() seem not to work, at least in a composite image. – What to do?

In long: I have the following code in my game:

Code: Select all

    image red_hover2=Composite(
        (768, 864),
        (0, 0), Transform("red", zoom=0.8),
        (0,390),Frame("black",xsize=768,ysize=150),
        (10,400), Text(_("Der Traum der roten Insel: \nNach der Eroberung durch das Mittelreich"),size=42,color="#D55",text_align=0.5)
Everything works fine when I'm in the base language (German). The translation file is also correctly produced:

Code: Select all

    # game/initialize.rpy:146
    old "Der Traum der roten Insel: \nNach der Eroberung durch das Mittelreich"
    new "Dream of the Red Island: \nAfter the conquest by the Middle Empire"
But the translation does not happen! When I play the game in English, it still shows the German message.
I guess that's a bug, but how can I circumvent it with least effort?
Do I have to define different images for each language? Or is there any more efficient method to do so? (We plan to have several languages, otherwise it wouldn't be a big thing.)

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Problems with translation in image composite Text

#2 Post by philat »

I'm unable to reproduce this. If you throw this into an empty project and run it (latest stable version), it works. (I chose pig latin because that will auto generate translations, but you can do it with any language.)

Code: Select all

image test_composite = Composite(
    (300, 300),
    (0, 0), Solid("#FFF9", xysize=(300,300)),
    (0, 0), Text(_("Test composite text"))
    )

screen translate():
    vbox:
        text _("Test screen text")
        textbutton "English" action Language(None)
        textbutton "Pig Latin" action Language("piglatin")

label start:
    show test_composite
    show screen translate
    pause

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1009
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Problems with translation in image composite Text

#3 Post by m_from_space »

philat wrote: Sun May 05, 2024 3:16 am I'm unable to reproduce this.
Works fine on my end as well, even using @thelastsecret's exact string (I mean it could have been an issue with some characters).

User avatar
thelastsecret
Regular
Posts: 121
Joined: Tue Mar 01, 2022 1:32 pm
Completed: The Last Secret
Projects: Sweet Science – The Girls from Silversee Castle
itch: thelastsecret
Discord: TheLastSecret #5266
Contact:

Re: Problems with translation in image composite Text

#4 Post by thelastsecret »

Strange... All other translations work... I'll have to try this out in a new project, as you suggested, to see where the problem might come from. I work with version 8.1.3, maybe that's the reason? Anyway, I'll keep you updated and thank you very much for your help!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot]