From 1f0c5ecb9092ed5ad69a4d2ce256fc3a09543a9a Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Sat, 15 Jun 2024 17:02:56 +0100 Subject: [PATCH] Ensure translation support in navigation and credits --- game/scripts/gui/credits.rpy | 4 +-- game/scripts/gui/navigation.rpy | 40 +++++++++++++++--------------- game/scripts/gui/player.rpy | 2 +- game/scripts/gui/settings.rpy | 44 ++++++++++++++++----------------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/game/scripts/gui/credits.rpy b/game/scripts/gui/credits.rpy index 0957d023..96027f80 100644 --- a/game/scripts/gui/credits.rpy +++ b/game/scripts/gui/credits.rpy @@ -36,7 +36,7 @@ define credits_images = [] # TODO: Add images once new chibis are in. define credits_mods = "\n\n## Game Mods\n\n" + "\n\n".join(["### " + i[1]["Name"] + "\n- " + i[1]["Author"] for i in mods_list.items()]) if mods_list else "" -define credits = credits.convert(f"""{{image=game_logo}}{{vspace=10}} +define credits = credits.convert(_(f"""{{image=game_logo}}{{vspace=10}} ## Development Team ### Project Lead @@ -229,7 +229,7 @@ define credits = credits.convert(f"""{{image=game_logo}}{{vspace=10}} - [renpy.license!t]{{vspace=300}} # Thank you for playing!{{vspace=300}} -""") +""")) style credits_header1: color "#ffffff" diff --git a/game/scripts/gui/navigation.rpy b/game/scripts/gui/navigation.rpy index d587580c..ad8ab25e 100644 --- a/game/scripts/gui/navigation.rpy +++ b/game/scripts/gui/navigation.rpy @@ -189,49 +189,49 @@ screen navigation(): vbox: style_prefix "navigation_tabs" - textbutton "Save" action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "save")] selected (category=="save") at navigation_tabs - textbutton "Load" action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "load")] selected (category=="load") at navigation_tabs - textbutton "Settings" action [SetLocalVariable("subcategory", "general"), SetLocalVariable("category", "settings")] at navigation_tabs - textbutton "Main Menu" action MainMenu() at navigation_tabs + textbutton _("Save") action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "save")] selected (category=="save") at navigation_tabs + textbutton _("Load") action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "load")] selected (category=="load") at navigation_tabs + textbutton _("Settings") action [SetLocalVariable("subcategory", "general"), SetLocalVariable("category", "settings")] at navigation_tabs + textbutton _("Main Menu") action MainMenu() at navigation_tabs null height 35 - textbutton "Return" action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym "game_menu" at navigation_tabs + textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym "game_menu" at navigation_tabs null height 35 - textbutton "Credits" action Show("credits") at navigation_tabs + textbutton _("Credits") action Show("credits") at navigation_tabs if category == "save": vbox: style_prefix "navigation_subtabs" - textbutton "A.Saves" action FilePage("auto") at navigation_tabs - textbutton "Q.Saves" action FilePage("quick") at navigation_tabs + textbutton _("A.Saves") action FilePage("auto") at navigation_tabs + textbutton _("Q.Saves") action FilePage("quick") at navigation_tabs null height 35 - textbutton "Next" action FilePageNext() at navigation_tabs - textbutton "Previous" action FilePagePrevious() at navigation_tabs + textbutton _("Next") action FilePageNext() at navigation_tabs + textbutton _("Previous") action FilePagePrevious() at navigation_tabs null height 35 - textbutton "Last Page" action FilePageLast() at navigation_tabs + textbutton _("Last Page") action FilePageLast() at navigation_tabs use file_slots(_("Save")) elif category == "load": vbox: style_prefix "navigation_subtabs" - textbutton "A.Saves" action FilePage("auto") at navigation_tabs - textbutton "Q.Saves" action FilePage("quick") at navigation_tabs + textbutton _("A.Saves") action FilePage("auto") at navigation_tabs + textbutton _("Q.Saves") action FilePage("quick") at navigation_tabs null height 35 - textbutton "Next" action FilePageNext() at navigation_tabs - textbutton "Previous" action FilePagePrevious() at navigation_tabs + textbutton _("Next") action FilePageNext() at navigation_tabs + textbutton _("Previous") action FilePagePrevious() at navigation_tabs null height 35 - textbutton "Last Page" action FilePageLast() at navigation_tabs + textbutton _("Last Page") action FilePageLast() at navigation_tabs use file_slots(_("Load")) elif category == "settings": vbox: style_prefix "navigation_subtabs" - textbutton "General" action SetLocalVariable("subcategory", "general") at navigation_tabs - textbutton "Display" action SetLocalVariable("subcategory", "display") at navigation_tabs - textbutton "Audio" action SetLocalVariable("subcategory", "audio") at navigation_tabs - textbutton "Other" action SetLocalVariable("subcategory", "other") at navigation_tabs + textbutton _("General") action SetLocalVariable("subcategory", "general") at navigation_tabs + textbutton _("Display") action SetLocalVariable("subcategory", "display") at navigation_tabs + textbutton _("Audio") action SetLocalVariable("subcategory", "audio") at navigation_tabs + textbutton _("Other") action SetLocalVariable("subcategory", "other") at navigation_tabs if subcategory == "audio": use settings_audio diff --git a/game/scripts/gui/player.rpy b/game/scripts/gui/player.rpy index 4f3ed0cd..915dcc0f 100644 --- a/game/scripts/gui/player.rpy +++ b/game/scripts/gui/player.rpy @@ -10,7 +10,7 @@ screen player(pos=(0.025, 0.2)): frame style "empty": pos pos - text "{bounce}Currently Playing{/bounce}" + text _("{bounce}Currently Playing{/bounce}") bar value AudioPositionValue() ypos 20 text "[renpy.music.get_playing()!i]" style "player_text_title" ypos 40 diff --git a/game/scripts/gui/settings.rpy b/game/scripts/gui/settings.rpy index 553fffda..7689aa82 100644 --- a/game/scripts/gui/settings.rpy +++ b/game/scripts/gui/settings.rpy @@ -49,15 +49,15 @@ screen settings_display(): action Preference("display", "window") sensitive (renpy.get_physical_size() != (config.screen_width, config.screen_height) and not preferences.fullscreen) - default fps_msg = "Framerate preference may take effect after restarting the game" + default fps_msg = _("Framerate preference may take effect after restarting the game") text _("Framerate") hbox: style_prefix "navigation_radio" - textbutton "30 FPS" action [Preference("gl framerate", 30), Notify(fps_msg)] + textbutton _("30 FPS") action [Preference("gl framerate", 30), Notify(fps_msg)] if renpy.get_refresh_rate() >= 60: - textbutton "60 FPS" action [Preference("gl framerate", 60), Notify(fps_msg)] - textbutton (f"{int(renpy.get_refresh_rate())} FPS") action [Preference("gl framerate", None), Notify(fps_msg)] + textbutton _("60 FPS") action [Preference("gl framerate", 60), Notify(fps_msg)] + textbutton (_(f"{int(renpy.get_refresh_rate())} FPS")) action [Preference("gl framerate", None), Notify(fps_msg)] if not renpy.variant("web"): default renderer_used = renpy.get_renderer_info()["renderer"] @@ -67,11 +67,11 @@ screen settings_display(): textbutton _("OpenGL"): selected renderer_used == "gl2" - action Confirm("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost.", Function(set_renderer, "gl2")) + action Confirm(_("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost."), Function(set_renderer, "gl2")) textbutton _("DirectX"): sensitive renpy.windows selected renderer_used == "angle2" - action Confirm("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost.", Function(set_renderer, "angle2")) + action Confirm(_("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost."), Function(set_renderer, "angle2")) text _("Image cache ([persistent.custom_settings['image_cache_size']]MB)") bar value DictValue(persistent.custom_settings, "image_cache_size", range=1792, max_is_zero=False, style="navigation_bar", offset=256, step=128, force_step=True, action=Notify(_("Restart the game to apply image cache size changes."))) tooltip _("Improves performance at a cost of higher memory usage.") @@ -135,17 +135,17 @@ screen settings_other(): hbox: style_prefix "navigation_radio" - textbutton "Small" action Preference("font size", 0.8) - textbutton "Default" action Preference("font size", 1.0) - textbutton "Large" action Preference("font size", 1.2) + textbutton _("Small") action Preference("font size", 0.8) + textbutton _("Default") action Preference("font size", 1.0) + textbutton _("Large") action Preference("font size", 1.2) text _("Vertical Text Spacing") hbox: style_prefix "navigation_radio" - textbutton "Small" action Preference("font line spacing", 0.8) - textbutton "Default" action Preference("font line spacing", 1.0) - textbutton "Large" action Preference("font line spacing", 1.2) + textbutton _("Small") action Preference("font line spacing", 0.8) + textbutton _("Default") action Preference("font line spacing", 1.0) + textbutton _("Large") action Preference("font line spacing", 1.2) if not renpy.mobile: vbox: @@ -159,8 +159,8 @@ screen settings_other(): text _("Advanced") vbox: - textbutton "Delete persistent data ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_PERSISTENT, Function(delete_persistent)) - textbutton "Delete save files ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_SAVES, Function(delete_saves)) + textbutton _("Delete persistent data ({color=#f00}!{/color})") action Confirm(gui.CONFIRM_DELETE_PERSISTENT, Function(delete_persistent)) + textbutton _("Delete save files ({color=#f00}!{/color})") action Confirm(gui.CONFIRM_DELETE_SAVES, Function(delete_saves)) frame style "navigation_page_right": add "doodle_glasses" align (0.5, 0.1) frame style "navigation_note": @@ -168,30 +168,30 @@ screen settings_other(): pos (20, 130) at transform: rotate 6 - text "TIP: If text overflows, try reducing vertical text spacing." + text _("TIP: If text overflows, try reducing vertical text spacing.") frame style "navigation_note": xysize (180, 180) pos (25, 230) at transform: rotate -4 - text "You could also try changing the font, it might help! :)" + text _("You could also try changing the font, it might help! :)") -define gui.CONFIRM_DELETE_PERSISTENT = """{color=#7a0000}Warning!{/color} +define gui.CONFIRM_DELETE_PERSISTENT = _("""{color=#7a0000}Warning!{/color} {size=-4}You are about to reset all persistent data, including achievements, seen text, and preferences.{/size}\n -Are you sure?""" +Are you sure?""") -define gui.CONFIRM_DELETE_SAVES = """{color=#7a0000}Warning!{/color} +define gui.CONFIRM_DELETE_SAVES = _("""{color=#7a0000}Warning!{/color} {size=-4}You are about to delete all save files, including auto saves, quick saves, and manual saves.{/size}\n -Are you sure?""" +Are you sure?""") -define gui.SAVE_INCOMPATIBLE_WARNING = """{color=#7a0000}Warning!{/color} +define gui.SAVE_INCOMPATIBLE_WARNING = _("""{color=#7a0000}Warning!{/color} {size=-4}The save file you are attempting to load is not compatible with the current game version. While you can try loading it, doing so may result in unexpected crashes and bugs. -Proceed anyway?""" +Proceed anyway?""") init python: def delete_persistent():