Toggling between english and spanish menus?

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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Toggling between english and spanish menus?

#1 Post by sasquatchii »

Hello,

I'm currently working on coding a menu for my game. I want to give players the option to toggle between english and spanish within the navigation menu. So basically, if they click "english" or "spanish" - all of the buttons in the menu will change to one or the other. Below is the UI design I created for the navigation menu to show roughly what I hope to accomplish:

Image
Image

I guess I'm wondering, what would be the best way to go about doing this? I have never done anything like this before in Ren'Py and I don't even know where to start.

Here is the code I'm using for my navigation (english) menu in Ren'Py, mostly with image maps and hotspots:

Code: Select all

creen navigation():

    imagemap:

            ground "gui/navigation-english-inactive.png"
            hover "gui/navigation-english-active.png"
            selected_idle "gui/navigation-english-active.png"


            hotspot (76, 84, 377, 92) action MainMenu()
            hotspot (504, 84, 331, 92) action ShowMenu('preferences')
            hotspot (891, 84, 253, 92) action ShowMenu('save')
            hotspot (1189, 84, 253, 92) action ShowMenu('load')
            hotspot (1490, 84, 295, 92) action Return()


style navigation_button is gui_button
style navigation_button_text is gui_button_text

style navigation_button:
    size_group "navigation"
    properties gui.button_properties("navigation_button")

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")
Any ideas or help would be much appreciated! Thanks for reading :)
ImageImage

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Toggling between english and spanish menus?

#2 Post by Per K Grok »

sasquatchii wrote: Tue Sep 01, 2020 2:11 am Hello,

I'm currently working on coding a menu for my game. I want to give players the option to toggle between english and spanish within the navigation menu. So basically, if they click "english" or "spanish" - all of the buttons in the menu will change to one or the other. Below is the UI design I created for the navigation menu to show roughly what I hope to accomplish:

Image
Image

I guess I'm wondering, what would be the best way to go about doing this? I have never done anything like this before in Ren'Py and I don't even know where to start.

Here is the code I'm using for my navigation (english) menu in Ren'Py, mostly with image maps and hotspots:

Code: Select all

creen navigation():

    imagemap:

            ground "gui/navigation-english-inactive.png"
            hover "gui/navigation-english-active.png"
            selected_idle "gui/navigation-english-active.png"


            hotspot (76, 84, 377, 92) action MainMenu()
            hotspot (504, 84, 331, 92) action ShowMenu('preferences')
            hotspot (891, 84, 253, 92) action ShowMenu('save')
            hotspot (1189, 84, 253, 92) action ShowMenu('load')
            hotspot (1490, 84, 295, 92) action Return()


style navigation_button is gui_button
style navigation_button_text is gui_button_text

style navigation_button:
    size_group "navigation"
    properties gui.button_properties("navigation_button")

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")
Any ideas or help would be much appreciated! Thanks for reading :)



What you can do is to have a variable, let's call it 'lang' that you can set to 'eng' or 'span'.

If the player clicks the button "English", action SetVariable("lang", "eng")
If the player clicks the button "Spanish", action SetVariable("lang", "span")

Whenever there is a place in the code where something could be presented either in English or Spanish, use an if/elif statement

Code: Select all

if lang=="eng":
    --- do the English stuff ---
elif lang=="span":   
    --- do the Spanish stuff ---

Post Reply

Who is online

Users browsing this forum: No registered users