Skip to content

Confirm localization saves, and keep localization mode across reloads - #1502

Merged
amyjko merged 1 commit into
mainfrom
localization-save-feedback
Nov 14, 2026
Merged

amyjko merged 1 commit into
mainfrom
localization-save-feedback

Conversation

@amyjko

@amyjko amyjko commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Context

A contributor editing Roman Urdu tutorial bubbles in localization mode pressed the footer's saved button, reloaded, and saw their edits gone. The edits were saved to IndexedDB. Two things made them look lost:

  • Localization mode switched off on every reload. Saved edits only show while the mode is on, so the page went back to the shipped text.
  • Nothing ever confirmed a save. The ✓ tooltip even said "Submit suggested edit". The reporter went looking for a save button and found the project's save status, which has nothing to do with localization.

A repro against the emulator in ur-Latn-PK confirmed both, and turned up a third bug: Learn served English to Roman Urdu readers. getTutorial and Progress built the locale string without its script subtag, requested ur-PK, found nothing and fell back to English. So the reporter was actually editing English text. Taiwanese Hokkien (nan-Latn-TW) had the same bug.

What changed

Localization mode is remembered on this device.

  • It's a device-local LocalizingSetting, kept in LocalesSetting.ts so Page.svelte's file count doesn't change.
  • The sign-out reset in Settings.svelte now acts only on a known sign-out ($user === null). It used to fire while the user was still undefined during every reload, which is also what wiped the saved setting in my first attempt.

Every save confirms itself.

  • All five save sites (MarkupHTMLView, LocalizedText, TermsEditor, GlossaryFormsEditor and the /localize workspace) go through commitLocaleEdit.
  • Each shows LocaleEditStatus: a visible "✓ Saved on this device" note, plus a locale-edit announcement that names the saved text, so two saves in a row aren't heard as one.
  • The note appears only after the IndexedDB write resolves. Unchanged text confirms nothing, which matters because LocalizedText commits on every blur.
  • A failed write now rolls back the optimistic store update (durably), keeps the editor open with the draft, and is announced on the ignored lane. Before, the page showed the edit as saved, and a reload lost it.
  • The status is imported dynamically, only after a first save. It turns localization mode's edit buttons off inside itself, so "saved" doesn't render as a button to press.

Wording.

  • ✓ now says "Save this edit on this device".
  • The ✏️ tooltip explains that an edit stays on this device until it's submitted.
  • A new line in the localization header says where edits go.
  • Six new strings and two reworded ones, translated in all 36 locales.

Budgets: the Page, home and projects byte budgets each rise by 0.01MB. The reason is documented in importGraph.test.ts. File counts are unchanged.

Contact sheet with screenshots and wording. It's private to the author.

Related issues

Verification

  • npm run check:now, npm run test:run, npm run test:sweep and npm run locales all pass, and drift against main is clear.
  • New unit tests:
    • announcements vary between two saves;
    • a failed save goes on the lane that re-presents identical text;
    • commitLocaleEdit reports nothing for unchanged text, saved for a change and reverted for the official text;
    • a failed write restores the store;
    • a tutorial link keeps ur-Latn-PK.
  • e2e: localize-glossary-forms.spec.ts now checks the saved note, the announcement, and the mode and draft surviving a reload. All 15 localize e2e tests pass locally against a fresh build.
  • Repro against the emulator in ur-Latn-PK: edit a bubble, reload, and both the mode and the edit remain. The tutorial now loads in Urdu.

Checklist

  • Strings translated (36 locales)
  • CHANGELOG entry
  • VoiceOver: hear one save announced
  • Follow-up, not in this PR: a tutorial bubble's inline editor is wider than the dialog column, so the column scrolls sideways and clips the start of the text and the status note.

🤖 Generated with Claude Code

…#1495)

A contributor edited Roman Urdu tutorial bubbles, pressed the footer's project
"saved" button, reloaded, and saw the edits gone. They were saved. But
localization mode switched off on every reload, and drafts only show in it;
and nothing ever confirmed a save (the ✓ even said "Submit").

- Localization mode is a device-local setting (in LocalesSetting.ts, which
  keeps Page.svelte's graph at its file count). The sign-out reset acts only
  on a known sign-out: it fired while the user was still unknown on reload.
- Every save site (MarkupHTMLView, LocalizedText, TermsEditor,
  GlossaryFormsEditor, the /localize workspace) goes through
  commitLocaleEdit and shows LocaleEditStatus: a visible note and a
  `locale-edit` announcement naming the text, only after the write lands. A
  failed write rolls the optimistic store back and keeps the draft open.
- The status is dynamically imported and renders outside localization mode's
  edit affordances. Page, home and projects byte budgets move by 0.01MB.
- ✓ and ✏️ tips say "save on this device"; the localization header says where
  edits go. Translated in all 36 locales.
- getTutorial and Progress dropped the script subtag, so Learn requested
  ur-PK and nan-TW, found nothing, and served English.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amyjko
amyjko merged commit ffc17b4 into main Nov 14, 2026
17 checks passed
@amyjko
amyjko deleted the localization-save-feedback branch November 14, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Localization save function not saving

1 participant