Best Way to Allow Players to Add a Translation Patch

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
Obscura
Eileen-Class Veteran
Posts: 1431
Joined: Fri Mar 09, 2012 6:58 pm
Projects: Coming Out On Top
Location: United States
Contact:

Best Way to Allow Players to Add a Translation Patch

#1 Post by Obscura »

I'd like to allow players to drop their self-translated .rpy files into the tl (translation) folder, and have the game create a menu that would allow them to select whatever languages are in that folder.

How would one go about doing this? Would this require the use of renpy.exists to check if a certain language is inside the folder?

Thank you in advance for any tips or advice!
Coming Out On Top - An Adult Gay Dating Sim
website

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Best Way to Allow Players to Add a Translation Patch

#2 Post by Remix »

You'd want renpy.known_languages. It *should* return a list that reflects the folder names in /tl/ if I remember right. Note though that some languages might also need different fonts, so you'd want to allow for that in your *blank* translate file(s) etc
Frameworks & Scriptlets:

User avatar
Obscura
Eileen-Class Veteran
Posts: 1431
Joined: Fri Mar 09, 2012 6:58 pm
Projects: Coming Out On Top
Location: United States
Contact:

Re: Best Way to Allow Players to Add a Translation Patch

#3 Post by Obscura »

Thanks Remix!!!

Do you know where I can find any examples of this in action? I'm scratching my head over the syntax.
Coming Out On Top - An Adult Gay Dating Sim
website

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Best Way to Allow Players to Add a Translation Patch

#4 Post by Remix »

Which bit?

Changing fonts etc:
https://www.renpy.org/doc/html/translat ... anslations

You might do well to try a single language translation yourself and seeing exactly what needs adding to the /tl/ subfolder, then use your experience to guide other people...

Simple screen:

Code: Select all

screen choose_language():

    vbox:

        textbutton "Default":
            selected (_preferences.language == None)
            action [ 
                Function(renpy.change_language, None),
                Function(renpy.restart_interaction) ]

        for language in renpy.known_languages():

            textbutton "{}".format(language.capitalize()):
                selected (
                    _preferences.language == language )
                action [ 
                    Function(renpy.change_language, 
                             language),
                    Function(renpy.restart_interaction) ]
Fly-typed, so might need tweaks
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: BeverlyLane