Skip to content

feat: Optimize translation-hub to support split-screen mode#1681

Open
0-o0 wants to merge 4 commits into
mengxi-ream:mainfrom
0-o0:feat-translator-tool
Open

feat: Optimize translation-hub to support split-screen mode#1681
0-o0 wants to merge 4 commits into
mengxi-ream:mainfrom
0-o0:feat-translator-tool

Conversation

@0-o0

@0-o0 0-o0 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Type of Changes

  • ✨ New feature (feat)
  • 🐛 Bug fix (fix)
  • 📝 Documentation change (docs)
  • 💄 UI/style change (style)
  • ♻️ Code refactoring (refactor)
  • ⚡ Performance improvement (perf)
  • ✅ Test related (test)
  • 🔧 Build or dependencies update (build)
  • 🔄 CI/CD related (ci)
  • 🌐 Internationalization (i18n)
  • 🧠 AI model related (ai)
  • 🔄 Revert a previous commit (revert)
  • 📦 Other changes that do not modify src or test files (chore)

Description

The project itself has already fully implemented the translation hub (translation-hub.html). We can achieve split-screen usage without affecting its original features. To this end, I have made extensive improvements and optimizations:By default, the split-screen is rendered via DOM. This is the most compatible rendering method, which also guarantees a consistent user experience on Firefox, Safari, and mobile devices. Meanwhile, to avoid breaking the DOM, a split-screen option based on browser split-screen APIs is also provided. These two approaches are not mutually exclusive—the DOM approach can serve as a robust fallback to prioritize and protect the user experience.During the compatibility adjustment for Firefox, I encountered and addressed specific issues such as TTS being unavailable and failures in private browsing mode. Firefox now delivers the same seamless experience as Edge. Due to the strict content script restrictions in Firefox, the floating window can only fall back to calling the DOM split-screen, whereas the popup and shortcuts successfully implement the browser API-based split-screen.

Related Issue

Closes #1491 #1196 #1643 #831 #1044 #925 #1633 #1668 #831 #1633 #1044 #1577 #1580 #1687

How Has This Been Tested?

  • Added unit tests covering split translator app flows, side panel behavior, shortcut binding/settings, navigation helpers, language detection handling, and config migration
  • Added unit tests
  • Verified through manual testing

Screenshots

2026-06-12.174831.mp4

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly if necessary
  • My code follows the code style of this project
  • My changes do not break existing functionality
  • If my code was generated by AI, I have proofread and improved it as necessary.

Additional Information

After multiple rounds of testing, the translation hub (translation-hub.html) is now fully supported on Edge, Chrome, and Firefox. It can be accessed via split-screen using shortcuts, the popup, and the floating window, with all of its original functions completely preserved. Additionally, it now features streaming output, saves translation languages, remembers preferred translation services, supports custom shortcuts, and automatically falls back to DOM rendering when the side panel API fails—ensuring the user experience is always prioritized.

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 70b51c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added feat contrib-trust:new PR author trust score is 0-29. needs-maintainer-review Contributor trust automation recommends maintainer review. labels Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Contributor trust score

20/100 — New contributor

This score estimates contributor familiarity with mengxi-ream/read-frog using public GitHub signals. It is advisory only and does not block merges automatically.

Outcome

Score breakdown

Dimension Score Signals
Repo familiarity 11/35 commits in repo, merged PRs, reviews
Community standing 5/25 account age, followers, repo role
OSS influence 0/20 stars on owned non-fork repositories
PR track record 4/20 merge rate across resolved PRs in this repo

Signals used

  • Repo commits: 1 (author commits reachable from the repository default branch)
  • Repo PR history: merged 1, open 1, closed-unmerged 0
  • Repo reviews: 0
  • PR changed lines: 6541 (+6250 / -291)
  • Repo permission: read
  • Followers: 0
  • Account age: 61 months
  • Owned non-fork repos considered: max 0, total 0 (0-o0/Xplan (0), 0-o0/0-o0 (0))

Policy

  • Low-score review threshold: < 30
  • Auto-close: score < 20 and changed lines > 1000
  • Policy version: v1.1

Updated automatically when the PR changes or when a maintainer reruns the workflow.

@mengxi-ream

Copy link
Copy Markdown
Owner

We use split-screen instead of adding DOM elements to the original webpage to avoid potential bugs in various components, such as using overlays within shadow DOM. These issues are really troublesome, so we ultimately decided to use split-screen. However, this does present some problems in Firefox, as the APIs are somewhat different. But we believe there are still not enough reasons for us to avoid using split-screen.

@0-o0

0-o0 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I understand your concerns, but looking at it from another perspective, this simply makes translate-hub.html more convenient to use. This functionality is already built into the project, and I decided to implement this feature after noticing multiple user requests for quickly translating external text.Thinking more broadly, we will eventually need to support mobile and desktop, as well as Chrome, Edge, Firefox, Safari, and more. This does not conflict with a standalone app; it merely extends the existing experience. Many users won't download a dedicated app just for translation, so offering a seamless extension experience is crucial for user retention. Coming back to this specific feature, it is simply an extension of the current translation hub designed to meet user needs, and it works perfectly on mobile as well.

0-o0 added 3 commits June 12, 2026 16:25
# Conflicts:
#	src/utils/config/__tests__/example/v078.ts
#	src/utils/config/__tests__/migration-scripts/v077-to-v078.test.ts
#	src/utils/config/migration-scripts/v077-to-v078.ts
#	src/utils/constants/config.ts
#	src/utils/constants/translate.ts

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70b51c5907

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/entrypoints/side.content/utils/translation-hub-panel.ts
@0-o0

0-o0 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@mengxi-ream It now runs perfectly across Edge, Chrome, and Firefox. The feature supports native browser-level split-screen and seamlessly falls back to DOM rendering in case of any failures, ensuring a stable user experience.

@mengxi-ream

Copy link
Copy Markdown
Owner

Sounds good! Will review this when I get time. This month gonna be busy for the notebase feature. So probably will review next month!

Thank you for your effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib-trust:new PR author trust score is 0-29. feat needs-maintainer-review Contributor trust automation recommends maintainer review. on-hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 希望点击扩展能有输入框快速翻译

3 participants