Skip to content

On-demand language switching with dropdown for translations - #18

Open
sdass1918 wants to merge 44 commits into
mainfrom
feature/language-switching
Open

On-demand language switching with dropdown for translations#18
sdass1918 wants to merge 44 commits into
mainfrom
feature/language-switching

Conversation

@sdass1918

@sdass1918 sdass1918 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Hey team,

This PR adds an on-demand language switching feature — instead of being locked to the language you selected before running the analysis, you can now switch languages anytime from a dropdown.

What changed:

  • Added a language dropdown (just an arrow icon button) next to the language tab so you can pick any of the 16 supported languages on the fly
  • The tab button shows the current language name, the dropdown is a separate 32px arrow-only select beside it
  • When you switch languages, it sends a TRANSLATE_TEXT message to the background which translates the already-rendered English summary + insights
  • Fixed a bug where cloning the English panel for a new language lost the accordion toggle click listeners (cloneNode doesn't copy addEventListener listeners) — re-attached them after clone
  • Fixed a bug where cloned panels for the quality action appeared below the resource breakdown — changed appendChild to insertBefore to keep panels in order
  • Fixed a race condition where switching language before STRUCTURED_INSIGHTS arrived would send the translate request without insights, leaving the insights spinner spinning forever — added _pendingInsightsLang flag to auto-retry when insights arrive

All 4 files touched: background.js, content/content.js, content/ui/overlay.js, content/ui/styles.js

sdass1918 and others added 30 commits May 25, 2026 16:05
The context-menu click handler must be async because subsequent logic awaits asynchronous checks (e.g. AI availability) before continuing. Without an async listener, await cannot be used and the workflow fails.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
checkAIAvailability() is async, but it's currently used as a boolean without await, so the Promise is always truthy and this guard never blocks when AI is unavailable.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
The parent context menu was registered for all pages, causing it to appear outside web.archive.org playback URLs. Clicking the menu on unsupported pages failed because no content script was injected there ("Receiving end does not exist"). Restrict the menu to Wayback playback URLs to prevent invalid usage.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
sdass1918 added 13 commits June 23, 2026 10:44
…fix screenshot capture timing and append format
…ntent for quality analysis

The quality analysis feature was broken because append() followed by
promptStreaming() does not reliably ground image data with Gemini Nano.
The model could not see the screenshot even though it was added to the
session history.

Fix: pass the image and text prompt together as a single structured
message array directly to promptStreaming() instead of using append().

Also removed page content from the quality prompt since it is not needed
for quality analysis and only wastes context window space. The content
extraction step is also skipped for quality actions to save time.
@sdass1918 sdass1918 changed the title feat: on-demand language switching with dropdown, fix clone accordion listeners and quality panel ordering On-demand language switching with dropdown for translations Jul 6, 2026
@sdass1918
sdass1918 force-pushed the feature/language-switching branch from 510b12a to cecb2e6 Compare July 6, 2026 14: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.

1 participant