Skip to content

refactor: simplify translate action by removing dual language selector - #12343

Merged
kangfenmao merged 3 commits into
mainfrom
refactor/simplify-translate-action
Jan 25, 2026
Merged

kangfenmao merged 3 commits into
mainfrom
refactor/simplify-translate-action

Conversation

@kangfenmao

@kangfenmao kangfenmao commented Jan 7, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Before this PR:

  • The translate action had two language selectors: "Target Language" and "Alternative Language"
  • The UI showed icons (🌐 → [Target] ← [Alternative] ❓) that implied a source-to-target translation flow
  • The actual behavior was "smart translation": detect source language, if it matches target, use alternative; otherwise use target

After this PR:

  • Single language selector for the target language
  • User selects what language they want to translate to - simple and clear
  • No more confusing auto-switching behavior

Why we need it and why it was done in this way

The following tradeoffs were made:

  • Removed the "smart" auto-detection feature in favor of explicit user control
  • Users who want bidirectional translation can manually change the target language

The following alternatives were considered:

  • Keeping both selectors but changing the UI to clearly show "Language A ↔ Language B" bidirectional flow
  • Adding clearer documentation/tooltips - but the feature was inherently confusing

Root cause: The dual-selector UI naturally leads users to expect "from Language A to Language B" flow (like Google Translate), but the actual behavior was different. This cognitive mismatch caused confusion.

Breaking changes

  • Users who relied on the auto-switching behavior will now need to manually select their target language
  • The stored setting key changed from translate:bidirectional:pair to translate:target:language

Special notes for your reviewer

The removed code included:

  • alterLanguage state and related logic
  • Language detection (detectLanguage) for auto-switching
  • Several unused imports and i18n keys (translate.alter_language, selection.action.translate.smart_translate_tips)

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Documentation: A user-guide update was considered and is present (link) or not required

Release note

Simplified translate action UI: replaced confusing dual language selector with single target language selector for clearer user experience

Note

Modernizes the translate selection window and related translations.

  • Replaces dual inline selectors with a single target LanguageSelect and adds a settings Dropdown to configure preferred_target and alter_language
  • Displays a read-only detected source language tag (translate.detected_source, translate.detecting) and tracks detectedLanguage/actualTargetLanguage state
  • Persists bidirectional pair to db.settings on change; adds direct target change handler
  • Updates icons (ArrowRight, Settings2), styling (createGlobalStyle), and menu components; removes spacer and adjusts layout
  • Adds/updates i18n keys across locales (en-us, zh-cn, zh-tw, de-de, el-gr, es-es, fr-fr, ja-jp, pt-pt, ro-ro, ru-ru): language_settings, preferred_target, detected_source, detecting

Written by Cursor Bugbot for commit 2c449d3. This will update automatically on new commits. Configure here.

@0xfullex

0xfullex commented Jan 8, 2026

Copy link
Copy Markdown
Member

去掉了智能翻译,原因是?

@kangfenmao

kangfenmao commented Jan 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

Note

This comment was translated by Claude.

Why was smart translation removed?

Some users reported that the translation feature was not working correctly. They thought the left side was the source language and the right side was the target language, leading them to believe the translation had failed. Actually, the right side was an alternative language.

This was more confusing in the UI.


Original Content

去掉了智能翻译,原因是?

有一些用户反馈翻译功能翻译不正确,他们以为左侧是选择的语言,右侧是目标语言。从而认为翻译失败了。实际上右侧是备选语言

这个在界面上更容易让人感到困惑

@EurFelux

EurFelux commented Jan 8, 2026 •

Copy link
Copy Markdown
Collaborator

Note

This comment was translated by Claude.

Many users are also accustomed to using this feature. Rather than removing it directly, it would be better to consider how to reduce the possibility of misunderstanding in the UI.


Original Content

也有很多用户习惯使用该功能。比起直接删除掉,不如考虑一下怎么在UI上减少误解的可能性。

@kangfenmao

kangfenmao commented Jan 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

Note

This comment was translated by Claude.

I will submit another PR with UI improvements.


Original Content

也有很多用户习惯使用该功能。比起直接删除掉,不如考虑一下怎么在UI上减少误解的可能性。
\r\n\r\n
我再提交一个 UI 改进版本的 pr

@0xfullex

0xfullex commented Jan 8, 2026 •

Copy link
Copy Markdown
Member

Note

This comment was translated by Claude.

I will submit another PR with UI improvements.

  1. We cannot cut features just to save effort when we should be putting effort into interaction and UI
  2. If improvements are needed, why not complete them in one PR instead of starting another?

Original Content

我再提交一个 UI 改进版本的 pr

1、咱不能为了省事,把本应该在交互和UI上的努力,变成干脆把功能砍掉
2、如果要改进,为何不在一个pr完成,非得再起一个pr?

…ettings dropdown

- Added state management for detected and actual target languages.
- Implemented a settings dropdown for selecting preferred and alternate languages.
- Updated UI to display detected language and integrated new settings for language selection.
- Refactored language change handling to improve user experience and maintain state consistency.
@kangfenmao
kangfenmao force-pushed the refactor/simplify-translate-action branch from 44d814c to 1a0b973 Compare January 21, 2026 03:13
@kangfenmao

kangfenmao commented Jan 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Note

This comment was translated by Claude.

The alternative language has been moved to the settings dropdown options.


Original Content

备选语言移动到了设置下拉选项里面了

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

…ructure

- Introduced LeftGroup for better alignment of detected language, target language selector, and settings dropdown.
- Removed unnecessary Spacer component to streamline the layout.
- Enhanced styling for improved visual consistency and user experience.
…guage

- Removed loading spinner and adjusted the display for the detected language during the detection process to enhance clarity and reduce visual clutter.
@kangfenmao
kangfenmao merged commit 78c6f97 into main Jan 25, 2026
1 check passed
@kangfenmao
kangfenmao deleted the refactor/simplify-translate-action branch January 25, 2026 05:38
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.

3 participants