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.
-
undersupervised
- Newbie
- Posts: 1
- Joined: Wed Jun 08, 2022 9:10 pm
-
Contact:
#1
Post
by undersupervised » Wed Jun 08, 2022 10:42 pm
I'd like to know what language (translation) is being displayed/rendered to the player at runtime. Currently I have code that includes:
Code: Select all
textbutton _("English") action [ Language(None), SetVariable("persistent.selected_translation", "english") ]
textbutton _("Spanish") action [ Language("spanish"), SetVariable("persistent.selected_translation", "spanish") ]
etc.
In other code I check the "persistent.selected_translation" variable.
This appears to work fine. However I'd prefer to reference some built-in variable that the Language action sets, if that exists. Any thoughts?
-
PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
-
Contact:
#2
Post
by PyTom » Wed Jun 08, 2022 11:29 pm
It's preferences.language. You can read it, but don't set it, as Language does a lot of work.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama •
https://www.patreon.com/renpytom
Users browsing this forum: No registered users