# Preferences Language Toggles Design ## Goal Add a new Language section to the preferences screen with two mutually exclusive toggles: - Default language (`None` translation), labeled `English` in default language and `Inglés` when Spanish is active. - Spanish language (`"spanish"` translation), labeled `Spanish` in default language and `Español` when Spanish is active. Selecting either toggle must immediately set the active game language. ## Scope - Modify only preferences UI and related translatable strings. - Preserve existing layout and visual language used by `Display` and `Skip` sections. - Keep behavior compatible with Ren'Py language switching conventions. - Work in the current active local translation branch (no git worktrees), to keep local playtesting straightforward. ## Current Context - `game/screens.rpy` currently defines two top-row preference blocks in `screen preferences()`: `Display` and `Skip`. - This row uses `hbox` with `box_wrap True` and section `vbox` blocks. - Spanish translations for screen strings live in `game/tl/spanish/screens.rpy`. ## Proposed UI/Behavior ### Placement Add a third `vbox` in the first preferences `hbox`, immediately after the `Skip` block, so Language appears to the right of Skip in desktop/web layout. ### Styling - Use `style_prefix "radio"` on the Language `vbox`. - Use `label _("Language")` for the section title so it matches existing section title styling and translation behavior. ### Controls Add two radio-style textbuttons: - `textbutton _("English") action Language(None)` - `textbutton _("Spanish") action Language("spanish")` These actions switch active language immediately and preserve mutual exclusivity through the radio preference button styling/selection behavior. ### Translation Labels (Option B) Add/ensure Spanish translations in `game/tl/spanish/screens.rpy`: - `Language` -> `Idioma` - `English` -> `Inglés` - `Spanish` -> `Español` Because button text is wrapped in `_()`, labels automatically localize based on active language. ## Error Handling and Edge Cases - If Spanish translations are unavailable at runtime, `Language("spanish")` still sets the language code; labels fall back based on available string catalog. - `Language(None)` safely returns to default strings. ## Validation Plan 1. Run lint: - `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" lint` 2. Run compile: - `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" compile` 3. Manual smoke check via run: - `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" run` Manual checks during run: - Open Preferences and verify Language section appears to the right of Skip. - Confirm title style matches Display/Skip. - Toggle English -> UI strings reflect default language. - Toggle Spanish -> UI strings reflect Spanish. - Confirm labels show `English/Spanish` in default language and `Inglés/Español` in Spanish. - Confirm only one language toggle appears active at a time. ## Out of Scope - Adding more languages. - Refactoring preferences screen structure beyond this section. - Any worktree setup or branch restructuring.