Text in screens

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
Triority
Regular
Posts: 134
Joined: Fri Jul 20, 2018 1:28 pm
Completed: Welcome To... Chichester 0, 1,2 OVN 1, OVN 2, OVN 3, No Regrets For The Future
Projects: Welcome To... Chichester series
Organization: Triority
itch: triority
Location: England
Contact:

Text in screens

#1 Post by Triority » Sun Oct 30, 2022 5:09 pm

Is there a way of extracting text (for translation or otherwise) from inside screen() functions? I use something like text __('Text') but it wont extract

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Text in screens

#2 Post by Ocelot » Sun Oct 30, 2022 6:02 pm

Can you show an example of what does not work?

Generally "Mark string as translateable" (_()) and "translate immideately" (__()) are enough if the rest of code is translation-friendly.
< < insert Rick Cook quote here > >

User avatar
Triority
Regular
Posts: 134
Joined: Fri Jul 20, 2018 1:28 pm
Completed: Welcome To... Chichester 0, 1,2 OVN 1, OVN 2, OVN 3, No Regrets For The Future
Projects: Welcome To... Chichester series
Organization: Triority
itch: triority
Location: England
Contact:

Re: Text in screens

#3 Post by Triority » Mon Oct 31, 2022 10:38 am

One example would be :

screen parentDialogue_S_1():
text "{font="+persistent.pref_text_font+"}{size=+0}{color=#d10aab}"+__('As requested, here\'s your report.')+"{/color}{/size}{/font}" at alpha_dissolve xpos MESSAGE_LEFT xanchor 0.0 ypos BASEMESSAGE_YPOS+(MESSAGE_YPOS*0.0) yanchor 0.0

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Text in screens

#4 Post by Ocelot » Mon Oct 31, 2022 10:49 am

__() should add string in list of transaltable strings. Did you regenerate translation file after adding it? Did you check whole translate strings statement that was generated? Sometimes string you want is hidden between unrelated strings.
< < insert Rick Cook quote here > >

User avatar
Triority
Regular
Posts: 134
Joined: Fri Jul 20, 2018 1:28 pm
Completed: Welcome To... Chichester 0, 1,2 OVN 1, OVN 2, OVN 3, No Regrets For The Future
Projects: Welcome To... Chichester series
Organization: Triority
itch: triority
Location: England
Contact:

Re: Text in screens

#5 Post by Triority » Mon Oct 31, 2022 3:41 pm

Ah, yes. Found it in the translated files. That's good.

Thanks for your help!

Post Reply

Who is online

Users browsing this forum: No registered users