Page 1 of 1
Best Way to Allow Players to Add a Translation Patch
Posted: Fri Jan 04, 2019 1:37 pm
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!
Re: Best Way to Allow Players to Add a Translation Patch
Posted: Fri Jan 04, 2019 2:40 pm
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
Re: Best Way to Allow Players to Add a Translation Patch
Posted: Fri Jan 04, 2019 3:06 pm
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.
Re: Best Way to Allow Players to Add a Translation Patch
Posted: Fri Jan 04, 2019 3:42 pm
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