# Preferences Language Toggles Implementation Plan

> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Add a Language section to Preferences with two mutually exclusive toggles that switch active game language between default (`None`) and Spanish (`"spanish"`), placed to the right of Skip.

**Architecture:** Extend the existing top preferences row in `screen preferences()` by adding one `radio`-styled `vbox` section for language controls. Use Ren'Py built-in `Language(...)` actions for immediate language switching and selected-state semantics. Update Spanish translation strings so button labels follow Option B behavior (`English/Inglés`, `Spanish/Español` depending on active language).

**Tech Stack:** Ren'Py screen language (`.rpy`), Ren'Py translation files (`game/tl/spanish/*.rpy`), Ren'Py CLI (`renpy.sh` lint/compile/run).

---

## File Structure

- Modify: `game/screens.rpy` (preferences layout and language toggle actions)
- Modify: `game/tl/spanish/screens.rpy` (translations for `Language`, `English`, `Spanish`)
- Reference: `docs/superpowers/specs/2026-03-20-preferences-language-toggles-design.md`

Notes:
- Keep all work in the currently active local translation branch.
- Do not create or use git worktrees for this task (required for local playtesting workflow).
- Follow existing `Display`/`Skip` section layout and style patterns.

## Chunk 1: Preferences UI Section

### Task 1: Add Language block in top preferences row

**Files:**
- Modify: `game/screens.rpy` (inside `screen preferences()` first `hbox` near existing `Display` and `Skip` blocks)

- [ ] **Step 1: Baseline acceptance check (expected to fail current requirement)**

Run: `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" run`
Expected baseline: Preferences has no `Language` section to the right of `Skip`.

- [ ] **Step 2: Add Language section with matching style/title**

In `screen preferences()` first `hbox`, add this `vbox` immediately after the existing `Skip` `vbox`:

```renpy
vbox:
    style_prefix "radio"
    label _("Language")
    textbutton _("English") action Language(None)
    textbutton _("Spanish") action Language("spanish")
```

Implementation details:
- Keep section placement in the same `hbox` that contains `Display` and `Skip`.
- Keep title wrapped in `_()`.
- Use `style_prefix "radio"` so title/button appearance matches established pattern.

- [ ] **Step 3: Run lint to validate screen syntax after UI change**

Run: `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" lint`
Expected: No new lint errors from preferences screen edits.

## Chunk 2: Translation Labels and End-to-End Validation

### Task 2: Add Spanish string mappings for Option B labels

**Files:**
- Modify: `game/tl/spanish/screens.rpy` (within `translate spanish strings:`)

- [ ] **Step 1: Add/confirm Spanish translations for new strings**

Ensure these mappings exist exactly once in `game/tl/spanish/screens.rpy`:

```renpy
old "Language"
new "Idioma"

old "English"
new "Inglés"

old "Spanish"
new "Español"
```

- [ ] **Step 2: Verify compile after translation update**

Run: `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" compile`
Expected: Successful compile.

- [ ] **Step 3: Manual smoke test for behavior and mutual exclusivity**

Run: `"renpy.sh" "/home/$USER/Documentos/Renpy Projects/Soul Droid Chat" run`

Validate in Preferences:
- `Language` section appears to the right of `Skip`.
- `Language` title style matches `Display` and `Skip` titles.
- Selecting `English` sets default language (`Language(None)`).
- Selecting `Spanish` sets Spanish language (`Language("spanish")`).
- Only one of the two language toggles appears selected at a time.
- Section title and labels behave per Option B/localization mappings:
  - Default language active: section title `Language`; buttons `English`, `Spanish`
  - Spanish active: section title `Idioma`; buttons `Inglés`, `Español`
  - Switching back to English restores title `Language` and buttons `English`, `Spanish`

## Completion Checklist

- [ ] Language section added with title `_("Language")`.
- [ ] Section appears to the right of Skip in the preferences top row.
- [ ] Toggles use `Language(None)` and `Language("spanish")`.
- [ ] Mutual exclusivity confirmed in UI selected state.
- [ ] Option B labels confirmed (`English/Inglés`, `Spanish/Español` by active language).
- [ ] `lint` and `compile` completed successfully.
- [ ] Manual run smoke check completed.
