For an added bit of spice, I also had this system predict your language. This will cause the language select screen to potentially be in the users correct language as it opens, instead of whatever your "None" language is. This will not force the VN into this language, only cause it to suggest it upon the first time it is opened.
Code to set up the language selector:
Code: Select all
init python: #Causes the VN to try and determine your computer's locale upon boot
import locale
persistent.locale = locale.getdefaultlocale()[0]
del locale
label splashscreen:
if not persistent.va_lang: #Set default localization
if "es" in persistent.locale:
$ renpy.change_language("spanish")
$ persistent.va_lang = "audio/va/spanish/"
elif "jp" in persistent.locale:
$ renpy.change_language("japanese")
$ persistent.va_lang = "audio/va/japanese/"
##add or remove any more languages you want. This uses the standard abbreviations of languages like
else: ##fallback case "zh" for Chinese, or "en" for English.
$ renpy.change_language(None)
$ persistent.va_lang = "audio/va/english/"
if not persistent.lang_select: #Allow user to select localization and voice acting language
pause 1.0
$ renpy.transition(dissolve)
call screen lang_select()
$ persistent.lang_select = True
Code: Select all
screen lang_select:
frame:
style_prefix "navigation"
yalign 0.5
xalign 0.5
xmaximum 1200
xpadding 45
ypadding 45
vbox:
style_prefix "radio"
label _("Select your language...")
null height 20
textbutton "English" action Language(None)
textbutton "Español" action Language("spanish")
textbutton "日本人" action Language("japanese")
null height 45
label _("Select your Voice Acting language...")
null height 20
textbutton "Español" action SetVariable('persistent.va_lang', "audio/va/spanish/")
textbutton "English" action SetVariable('persistent.va_lang', "audio/va/english/")
textbutton "日本人" action SetVariable('persistent.va_lang', "audio/va/japanese/")
null height 45
textbutton _("CONTINUE") action Return()
Code: Select all
voice persistent.va_lang+"e01.ogg"
e "Hello, I'm Eileen!"
voice persistent.va_lang+"e02.ogg"
e "I hope you're having a great day!"