Skip to content

修复翻译页保存失败无提示#328

Merged
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:fix/issue-314-translation-save-feedback
May 7, 2026
Merged

修复翻译页保存失败无提示#328
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:fix/issue-314-translation-save-feedback

Conversation

@H-Chris233
Copy link
Copy Markdown
Collaborator

@H-Chris233 H-Chris233 commented May 7, 2026

User description

摘要

  • 为 Translation 页的工作语言、翻译目标语言、翻译快捷键保存路径补上 saving/saved/failed 状态提示
  • 捕获保存失败,避免 promise rejection 静默丢失;偏好写入失败后刷新后端状态以回滚乐观 UI
  • 为新增提示补齐简体中文、繁体中文、英文、日文、韩文文案

验证

  • npm run build
  • git diff --check

Closes #314


PR Type

Bug fix, Enhancement


Description

  • Add save feedback banner

  • Catch translation save failures

  • Separate hotkey register errors

  • Localize new failure messages


Diagram Walkthrough

flowchart LR
  A["Translation page"] -- "working / target language save" --> B["savePrefs"]
  A -- "translation hotkey save" --> C["setTranslationHotkey"]
  B -- "success / failure" --> D["status banner"]
  C -- "success / failure" --> D
  B -- "refresh prefs on failure" --> E["Hotkey settings refresh"]
Loading

File Walkthrough

Relevant files
Bug fix
Translation.tsx
Add save-state feedback to translation page                           

openless-all/app/src/pages/Translation.tsx

  • Introduces saving, saved, and failed UI states with a dismissing
    status banner.
  • Wraps working language and target language persistence in a shared
    async helper with error handling.
  • Splits translation hotkey saving into register and preference-save
    steps, stopping on registration failure.
  • Refreshes preferences after save errors to roll back stale optimistic
    UI state.
+90/-9   
Enhancement
en.ts
Add English translation save errors                                           

openless-all/app/src/i18n/en.ts

  • Adds localized messages for working-language save failure.
  • Adds localized messages for translation target save failure.
  • Adds separate messages for translation hotkey registration and save
    failures.
+6/-0     
ja.ts
Add Japanese translation save errors                                         

openless-all/app/src/i18n/ja.ts

  • Adds localized messages for working-language save failure.
  • Adds localized messages for translation target save failure.
  • Adds separate messages for translation hotkey registration and save
    failures.
+6/-0     
ko.ts
Add Korean translation save errors                                             

openless-all/app/src/i18n/ko.ts

  • Adds localized messages for working-language save failure.
  • Adds localized messages for translation target save failure.
  • Adds separate messages for translation hotkey registration and save
    failures.
+6/-0     
zh-CN.ts
Add Simplified Chinese save failures                                         

openless-all/app/src/i18n/zh-CN.ts

  • Adds localized messages for working-language save failure.
  • Adds localized messages for translation target save failure.
  • Adds separate messages for translation hotkey registration and save
    failures.
+6/-0     
zh-TW.ts
Add Traditional Chinese save failures                                       

openless-all/app/src/i18n/zh-TW.ts

  • Adds localized messages for working-language save failure.
  • Adds localized messages for translation target save failure.
  • Adds separate messages for translation hotkey registration and save
    failures.
+6/-0     

Translation settings were optimistically updated without awaiting or surfacing write failures, so users could see enabled language and shortcut states that were never persisted. This keeps the fix inside the Translation page: all three save paths now show saving/saved/failed feedback, catch failed writes, and refresh preferences after failed preference persistence to roll back local state.

Constraint: Follow the new beta-first PR workflow from Open-Less#327.

Rejected: Refactor HotkeySettingsContext queue behavior | issue explicitly excludes queue redesign.

Confidence: high

Scope-risk: narrow

Directive: Keep Translation page save feedback local unless SelectionAsk receives the same treatment in its own issue.

Tested: npm run build

Tested: git diff --check

Related: Open-Less#314
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

314 - Fully compliant

Compliant requirements:

  • Saving / saved / failed feedback added for all three save paths.
  • Save failures are caught and logged instead of being left unhandled.
  • Local state is refreshed after preference save failures.
  • Hotkey registration failure stops the preference save flow.
  • New messages were added in zh-CN, zh-TW, en, ja, and ko.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233 H-Chris233 merged commit 0b8c7b4 into Open-Less:beta May 7, 2026
1 check passed
@H-Chris233 H-Chris233 deleted the fix/issue-314-translation-save-feedback branch May 9, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ui][bug] Translation 页保存动作无 saving/saved/error 反馈 — 失败用户无感

1 participant