--- name: verify-language-switch description: 'Prove a language switch translates what the user sees, keeps what they had already typed, and is still in force after a reload. Use when i18n, a locale picker, a language menu or translation files were added or changed, when a string is suspected of staying in the old language or showing a raw translation key, or when a user reports losing their form or their language choice after switching or refreshing.' license: Apache-2.0 metadata: version: 3.7.0 homepage: https://www.reticle.sh repository: https://github.com/reticlehq/reticle --- # A translated heading is not a translated page Clicking the language menu and seeing one word change proves one string was wired up. It does not prove the rest of the page followed, that the field the user was in the middle of filling still holds what they typed, or that the choice outlives a refresh. Those are three separate bugs. Each ships regularly, and glancing at the page after the click catches none of them. **Reticle** can prove all three in the running app, with no test code. Not installed? `RETICLE_INSTALL_SOURCE=npx_skill npx @reticlehq/server@latest init`, then the [`install-and-verify`](https://github.com/reticlehq/reticle/blob/main/skills/install-and-verify/SKILL.md) skill. ## Before you start - **Confirm the session can observe:** `reticle_session({ action: "list" })`. A hidden or throttled tab can accept a click and render nothing. If it is not healthy, report the run as **blocked**, not passed. - **Take the expected strings from the app, not from your head.** Open its translation files (`locales/`, `messages/`, `i18n/`) and copy the target-language value for each string you will assert on. A translation you guessed can fail on a correct app, and one you half-remember can pass on a wrong one. - **Pick strings that are not already on the page.** A language menu that lists "Español" satisfies `{ kind: "text", contains: "Español" }` before you click, and the verdict comes back `already_true`. Assert on the translated heading or a nav label instead, and `scope` the predicate to the region it lives in. ## 1. Note what is on screen, and type something ``` reticle_look({ action: "page", sessionId }) ``` Write down two or three visible strings in the current language from **different regions** of the page: the heading, a nav label, a button. One string proves one component; two regions prove the switch reached the page. Then type a value into a form field, so step 3 has something to find: ``` reticle_look({ action: "page", sessionId, mode: "interactive" }) reticle_act({ sessionId, ref: "", action: "fill", args: { value: "reticle-i18n-4471" } }) ``` The result must show `valueChanged: true`. Use a value nothing else on the page contains, so step 3 proves **this** input survived rather than a default being refilled. ## 2. Switch, and name what must change before you act Get the switch control's ref from the interactive look. A `