Skip to content

Commit

Permalink
Add language selection screen
Browse files Browse the repository at this point in the history
  • Loading branch information
RuolinZheng08 committed Jan 4, 2022
1 parent 9fb7a26 commit 79203e6
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 82 deletions.
Binary file not shown.
17 changes: 12 additions & 5 deletions game/screens.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ screen quick_menu():
textbutton '{icon=icon-save} ' + _("Save") action ShowMenu('save')
# textbutton _("Q.Save") action QuickSave()
# textbutton _("Q.Load") action QuickLoad()
textbutton '{icon=icon-settings} ' + _("Settings ") action ShowMenu('preferences')
textbutton '{icon=icon-settings} ' + _("Settings") action ShowMenu('preferences')

# if stats is showing, hide it; else show it
if stats_unlocked:
textbutton _("{icon=icon-smartphone} Stats") action [
textbutton '{icon=icon-smartphone} ' + _("Stats") action [
SensitiveIf(not renpy.get_screen('player_stats_todo_screen', layer='transient')),
If(
renpy.get_screen('player_stats_todo_screen'),
Expand Down Expand Up @@ -815,17 +815,24 @@ screen preferences():
textbutton _("After Choices") action Preference("after choices", "toggle")
textbutton _("Transitions") action InvertSelected(Preference("transitions", "toggle"))

## Additional vboxes of type "radio_pref" or "check_pref" can be
## added here, to add additional creator-defined preferences.

vbox:
style_prefix "check"
label _("Others")
label _("Features")
textbutton _("Moving Text") action [
ToggleField(persistent, 'enable_moving_text'),
Function(configure_text_tags)
]
textbutton _("Save Reminder") action ToggleField(persistent, 'enable_save_reminder')

## Additional vboxes of type "radio_pref" or "check_pref" can be
## added here, to add additional creator-defined preferences.
vbox:
style_prefix "radio"
label _("Language")
textbutton _("English") action Language(None)
textbutton _("{font=fonts/simplified_chinese/NotoSansSC-Regular.otf}中文{/font}") action Language("simplified_chinese")


null height (4 * gui.pref_spacing)

Expand Down
14 changes: 7 additions & 7 deletions game/scripts/bonus_screen.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ screen bonus_screen():
vbox:
spacing 15

label 'Minigames'
label _('Minigames')
textbutton '{icon=icon-music} ' + _("Rhythm Game") action Start('rhythm_game_entry_label')
# TODO: more mini games, quiz speedrun survival mode etc.

null height 20
label 'Bonus Content'
label _('Bonus Content')
textbutton '{icon=icon-award} ' + _("Achievements") action Show('achievements_screen')
textbutton '{icon=icon-headphones} ' + _("Music Room"):
action [
Expand All @@ -31,14 +31,14 @@ screen bonus_screen():
# textbutton '{icon=icon-youtube} ' + _("Learn to Code RPG: The Making of") action NullAction()

null height 20
label 'Other Links'
label _('Other Links')
textbutton '{icon=icon-thumbs-up} ' + _("Rate and Review This Game on itch.io") action OpenURL(itch_url)
textbutton '{icon=icon-github} ' + _("Check out This Game's Source Code on GitHub") action OpenURL(github_url)
textbutton '{icon=icon-file-text} ' + _("Read Our Dev Log Article (a Let's Play Video Included)") action OpenURL(article_url)
textbutton '{icon=icon-heart} ' + _("Support Us by Donating to freeCodeCamp.org") action OpenURL('https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/')

null height 20
label 'Awesome freeCodeCamp.org Resources'
label _('Awesome freeCodeCamp.org Resources')
textbutton '{icon=icon-youtube} ' + _("freeCodeCamp YouTube Channel") action OpenURL("https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ")
textbutton '{icon=icon-map} ' + _("freeCodeCamp Curriculum") action OpenURL("https://www.freecodecamp.org/learn/")
# textbutton '{icon=icon-compass} ' + _("freeCodeCamp Forum") action OpenURL("https://forum.freecodecamp.org/")
Expand All @@ -55,9 +55,9 @@ screen achievements_screen():

vbox:
$ num_achievements = len(persistent.achievements)
text _("{icon=icon-award} Number of Achievements Unlocked: [num_achievements] / [total_num_achievements]"):
text "{icon=icon-award} " + _('Number of Achievements Unlocked:') + ' [num_achievements] / [total_num_achievements]':
font gui.text_font
textbutton "{icon=icon-twitter} Tweet it when you've unlocked all of the achievements!":
textbutton "{icon=icon-twitter} " + _("Tweet it when you've unlocked all of the achievements!"):
action [
SensitiveIf(num_achievements == total_num_achievements),
OpenURL(tweet_all_achievements_unlocked)
Expand All @@ -79,7 +79,7 @@ screen achievements_screen():
$ tweet = achievement_to_tweet_map[achievement]
text '{icon=icon-unlock} [achievement]':
font gui.text_font
textbutton '{icon=icon-twitter} Tweet this' action OpenURL(tweet)
textbutton '{icon=icon-twitter} ' + _("Tweet this") action OpenURL(tweet)
else:
text '{icon=icon-lock} ? ? ?':
font gui.text_font
Expand Down
4 changes: 2 additions & 2 deletions game/scripts/calendar.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ init python:
self.month = month
self.year = year

self.month_names = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December']
self.month_names = ['', _('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'),
_('August'), _('September'), _('October'), _('November'), _('December')]
self.days_count = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def next(self):
Expand Down
8 changes: 4 additions & 4 deletions game/scripts/confirm_and_share.rpy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://www.renpy.org/doc/html/screen_special.html
# based on the confirm screen

define alternative_endind_message = "Congratulations! You just discovered an alternative ending."
define alternative_endind_message = _("Congratulations! You just discovered an alternative ending.")

screen confirm_and_share_screen(title, message=None, ok_text=None, tweet_content_url=tweet_default, show_achievements_count=True):

Expand Down Expand Up @@ -30,22 +30,22 @@ screen confirm_and_share_screen(title, message=None, ok_text=None, tweet_content
font gui.interface_text_font

if message is None:
$ message = "Now that's an achievement unlocked!"
$ message = _("Now that's an achievement unlocked!")
text _(message):
xalign 0.5
text_align 0.5

if show_achievements_count:
$ num_achievements = len(persistent.achievements)
text _("Number of Achievements Unlocked: [num_achievements] / [total_num_achievements]"):
text _("Number of Achievements Unlocked:") + " [num_achievements] / [total_num_achievements]":
xalign 0.5

textbutton "{icon=icon-twitter} " + _("Tweet this"):
xalign 0.5
action OpenURL(tweet_content_url)

if ok_text is None:
$ ok_text = "Gotta Unlock 'Em All!"
$ ok_text = _("Gotta Unlock 'Em All!")
textbutton ok_text:
xalign 0.5
action [
Expand Down
8 changes: 7 additions & 1 deletion game/scripts/definitions.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,10 @@ init:

attribute glasses default

attribute_function Picker(expressions)
attribute_function Picker(expressions)

## translation styles
translate simplified_chinese python:
gui.text_font = "fonts/simplified_chinese/NotoSansSC-Regular.otf"
gui.name_text_font = "fonts/simplified_chinese/NotoSansSC-Regular.otf"
gui.interface_text_font = "fonts/simplified_chinese/NotoSansSC-Regular.otf"
9 changes: 9 additions & 0 deletions game/scripts/splashscreen.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ label splashscreen:
scene gray90 with dissolve
with Pause(1)

if not persistent.language_selected:
scene black
menu:
"English":
$renpy.change_language(None)
"{font=fonts/simplified_chinese/NotoSansSC-Regular.otf}中文{/font}":
$renpy.change_language("simplified_chinese")
$ persistent.language_selected = True

$ accessibility_tips = _p("""
Accessibility Tips: To enable auto-voicing of the text, please first configure the speech synthesis settings (speaker gender, accent, etc.) on your computer according to {a=https://www.renpy.org/doc/html/self_voicing.html#speech-synthesis}these instructions{/a}.
Back to the game, you may press the {b}{u}v{/u}{/b} key to switch on auto-voicing.
Expand Down
Loading

0 comments on commit 79203e6

Please sign in to comment.