Reviewed-on: #1 Co-authored-by: Wally Hackenslacker <mastor89@protonmail.com> Co-committed-by: Wally Hackenslacker <mastor89@protonmail.com>
3.1 KiB
3.1 KiB
Preferences Language Toggles Design
Goal
Add a new Language section to the preferences screen with two mutually exclusive toggles:
- Default language (
Nonetranslation), labeledEnglishin default language andIngléswhen Spanish is active. - Spanish language (
"spanish"translation), labeledSpanishin default language andEspañolwhen 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
DisplayandSkipsections. - 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.rpycurrently defines two top-row preference blocks inscreen preferences():DisplayandSkip.- This row uses
hboxwithbox_wrap Trueand sectionvboxblocks. - 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 Languagevbox. - 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->IdiomaEnglish->InglésSpanish->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
- Run lint:
"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" lint
- Run compile:
"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" compile
- 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/Spanishin default language andInglés/Españolin 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.